realtimenetprots/sipfw/SIP/ConnectionMgr/inc/COwnerSettingsList.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 * Name        : COwnerSettingsList.h
       
    16 * Part of     : ConnectionMgr
       
    17 * See class definition below.
       
    18 * Version     : SIP/4.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @internalComponent
       
    27 */
       
    28 #ifndef COWNERSETTINGSLIST_H
       
    29 #define COWNERSETTINGSLIST_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 #include <es_sock.h> 
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class COwnerSettings;
       
    37 class TSIPTransportParams;
       
    38 class TInetAddr;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 class COwnerSettingsList : public CBase
       
    42     {
       
    43 public: // Constructor and destructor
       
    44     
       
    45     static COwnerSettingsList* NewL();
       
    46     
       
    47     ~COwnerSettingsList();
       
    48     
       
    49 private: // Private contruction
       
    50     
       
    51     COwnerSettingsList();
       
    52     
       
    53 public: // Public methods
       
    54 
       
    55     void AddSettingsL( const TSIPTransportParams& aParams,
       
    56                        TUint aOptionName,
       
    57                        TUint aOptionLevel,
       
    58                        TInt aOption );
       
    59                        
       
    60     void AddSettingsL( const TSIPTransportParams& aParams,
       
    61                        TUint aOptionName,
       
    62                        TUint aOptionLevel,
       
    63                        const TDesC8& aOption );
       
    64     
       
    65     void RemoveSettings( const TSIPTransportParams& aParams );
       
    66     
       
    67     TBool RemoveSettings( TUint32 aTransportId );
       
    68     
       
    69     TBool IsRequestedOpts( const TSIPTransportParams& aParams ) const;
       
    70     
       
    71     void SetOpts( const TSIPTransportParams& aParams, 
       
    72                   RSocket& aSocket );   
       
    73     
       
    74     void ClearOpts( const TSIPTransportParams& aParams, 
       
    75                     RSocket& aSocket );   
       
    76                     
       
    77     /**
       
    78      * @return ETrue if settings matching aOldParams existed
       
    79      */            
       
    80     TBool SaveTransportInfoL( const TSIPTransportParams& aOldParams, 
       
    81                               const TSIPTransportParams& aParams, 
       
    82                               TUint aLocalSendPort,
       
    83                               TUint aLocalReceivePort,
       
    84                               const TInetAddr& aRemoteAddr,
       
    85                               TUint aRemoteSendPort );
       
    86     
       
    87     void SaveTLSTransportInfoL( const TSIPTransportParams& aParams );
       
    88      
       
    89     void ReservePrivatePortL( const TSIPTransportParams& aParams, 
       
    90                               TUint aPort );
       
    91                                
       
    92     TUint GetPrivatePortL( const TSIPTransportParams& aParams ); 
       
    93     
       
    94     TBool HasSavedTransportInfo( TUint32 aTransportId ) const;
       
    95     
       
    96     TBool HasSavedTLSTransportInfo( TUint32 aTransportId ) const;
       
    97     
       
    98     TUint SavedLocalSendPort( TUint32 aTransportId ) const;
       
    99     
       
   100     TUint SavedLocalReceivePort( TUint32 aTransportId ) const;
       
   101     
       
   102     const TInetAddr* SavedRemoteAddr( TUint32 aTransportId ) const;
       
   103     
       
   104     TBool IsReceivingAllowed( const TSIPTransportParams& aParams, 
       
   105                               const TInetAddr& aRemoteAddr,
       
   106                               TUint aProtocol,
       
   107                               TUint aLocalPort ) const;
       
   108                               
       
   109     TUint32 FindTransportId( const TInetAddr& aRemoteAddr ) const;
       
   110     
       
   111     void SaveTLSRemoteL( const TSIPTransportParams& aParams,
       
   112                          const TInetAddr& aRemoteAddr );
       
   113     
       
   114 private: // Private methods
       
   115 
       
   116     COwnerSettings& FindOwnerSettingsL( const TSIPTransportParams& aParams,
       
   117                                         TBool aAllowExisting = ETrue ); 
       
   118     
       
   119     TInt FindOwnerSettingsIndex( const TSIPTransportParams& aParams ) const;
       
   120     
       
   121     TInt FindOwnerSettingsIndex( TUint32 aTransportId ) const;
       
   122   
       
   123     TBool IsReservedTransport( TUint32 aTransportId ) const;
       
   124     
       
   125 private: // Data
       
   126 
       
   127     RPointerArray<COwnerSettings> iSettings;
       
   128     
       
   129 private: // For unit testing
       
   130 #ifdef CPPUNIT_TEST
       
   131     friend class COwnerSettingsListTest; 
       
   132     friend class CSipConnectionMgrTest;
       
   133 #endif
       
   134     };
       
   135     
       
   136 #endif // COWNERSETTINGSLIST_H
       
   137 
       
   138 // end of file