realtimenetprots/sipfw/ClientResolver/Resolver/inc/CSIPClientResolver.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          : CSIPClientResolver.h
       
    16 * Part of       : SIP Client Resolver
       
    17 * Version       : 1.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef CSIPCLIENTRESOLVER_H
       
    29 #define CSIPCLIENTRESOLVER_H
       
    30 
       
    31 #include <e32base.h>
       
    32 #include <ecom/ecom.h>
       
    33 #include "MSipClients.h"
       
    34 #include "_sipcodecdefs.h"
       
    35 
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CSIPClientData;
       
    39 class CSIPClientDataParser;
       
    40 class CSipLaunchingStrategies;
       
    41 class TSipClient;
       
    42 class CSIPRequest;
       
    43 class CSIPResponse;
       
    44 class CSIPClientResolver2;
       
    45 
       
    46 // CLASS DEFINITIONS
       
    47 /**
       
    48  *
       
    49  */
       
    50 class CSIPClientResolver : public CActive, public MSipClients
       
    51     {
       
    52     public: // Constructors and destructor
       
    53 	
       
    54         IMPORT_C static CSIPClientResolver* NewL ();
       
    55     
       
    56         IMPORT_C ~CSIPClientResolver ();
       
    57 
       
    58     public: // New functions
       
    59 
       
    60         IMPORT_C CSIPResponse* FindUidL(const CSIPRequest& aRequest,
       
    61 								RArray< TSipClient >& aUids );
       
    62 		
       
    63     public: // From MSipClients
       
    64 
       
    65         MSipClient* GetByUID( const TUid& aUid ) const;
       
    66 
       
    67     protected: // From CActive
       
    68 
       
    69         void DoCancel();
       
    70         void RunL();   
       
    71 
       
    72     private: // New methods
       
    73 
       
    74 		/**
       
    75 		* Refreshes clients' data for those clients
       
    76 		* which are returning their SIP capabilities dynamically
       
    77 		* instead of using fixed values in their plugin's resource file.
       
    78 		*/
       
    79         void RefreshClientDataL();
       
    80 
       
    81 		/// Fill implentation registry
       
    82 		void ListImplementationsL();
       
    83 
       
    84 		/// Delete implementation registry
       
    85 		void RemoveRegistry();
       
    86 
       
    87 		/// Start monitoring changes in ECom plugin implementations 
       
    88 		void NotifyOnChange();
       
    89 
       
    90 		/// Copies all the current implementations to the given array  
       
    91 		void CopyAllUidsL( RArray< TUid >& aUids );
       
    92 
       
    93         /// Adds ROM- and RAM-based clients to the array
       
    94         void AddClientsL( RPointerArray< CSIPClientData >& aRegistry );
       
    95 
       
    96         /// Converts and appends ECom implementation information
       
    97         /// to and array of CSIPClientDatas
       
    98         void ConvertClientDataL( const RImplInfoPtrArray& aImplInfo,
       
    99                                  RPointerArray< CSIPClientData >& aRegistry,
       
   100                                  TBool aRomClient );
       
   101 
       
   102 	    /// Adds CSIPClientData to the array based on ECom-plugin's data
       
   103 		void AddClientDataL( RPointerArray< CSIPClientData >& aRegistry,
       
   104 			                 CImplementationInformation& aInfo,
       
   105 			                 TBool aRomClient );
       
   106 		
       
   107 		/// Creates a thread to load the client plugin and 
       
   108 	    /// ask the capabilities from it and parses the results	                 
       
   109         void ReloadClientDataL( CSIPClientData& aClientData );
       
   110 
       
   111         /// Removes the implementations present in the first array 
       
   112         /// from the second array.
       
   113         void RemoveDuplicates( const RImplInfoPtrArray& aRomInfo,
       
   114                                RImplInfoPtrArray& aAllInfo );
       
   115 
       
   116 		// Needed for cleanup of a RPointerArray< CSIPClientData >:
       
   117 		static void ResetAndDestroy( TAny* anArray );
       
   118 		
       
   119 	    void CreateWorkerThreadL();
       
   120 	
       
   121 	    static TInt WorkerThreadFunction(TAny* aPtr);
       
   122 	
       
   123 	    void ReadPluginCapsL();		
       
   124 
       
   125     private:  // Constructors
       
   126 
       
   127         /// Default constructor
       
   128         CSIPClientResolver();
       
   129     
       
   130         /// 2nd phase constructor.
       
   131         void ConstructL();
       
   132     
       
   133     private: // private data
       
   134 
       
   135         /// Handle to ECom session. Owned.
       
   136         REComSession* iECom;
       
   137 
       
   138         /// XML parser for SIP client data
       
   139         CSIPClientDataParser* iClientDataParser;
       
   140 
       
   141         /// Information registry for installed SIP clients. Owned.
       
   142         RPointerArray< CSIPClientData >* iRegistry;
       
   143 
       
   144         /// Launching strategies. Owned.
       
   145         CSipLaunchingStrategies* iLaunchingStrategies;
       
   146         
       
   147         /// Used for parameter passing to worker thread
       
   148         TUid iTmpImplementationUid;
       
   149         
       
   150         /// Used for parameter passing to worker thread
       
   151         HBufC8* iTmpPluginCaps;
       
   152 
       
   153     private: // For testing purposes
       
   154 
       
   155          UNIT_TEST(CSIPClientResolver_test)
       
   156     };
       
   157 
       
   158 #endif // CSIPCLIENTRESOLVER_H
       
   159 
       
   160 // End of File