mmsharing/mmshavailability/inc/musavaclientresolverutil.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     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:  Utility class to handle SIP client resolver cenrep table.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MUSAVACLIENTRESOLVERUTIL_H
       
    22 #define MUSAVACLIENTRESOLVERUTIL_H
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 class CRepository;
       
    27 class CSIPProfile;
       
    28 
       
    29 /**
       
    30  *  Utility class to handle SIP client resolver cenrep table.
       
    31  *  This class must be used in __VOIP enabled builds in order to use common
       
    32  *  SIP client resolver plugin with VoIP.
       
    33  *
       
    34  *  @code
       
    35  *      clientResolver = CMusAvaClientResolverUtil::NewLC();
       
    36  *      clientResolver->RegisterClientWithUserL( 
       
    37  *              KImplementation, iContactHeaderUser, KResolver );
       
    38  *      CleanupStack::PopAndDestroy( clientResolver );
       
    39  *  @endcode
       
    40  *
       
    41  */
       
    42 NONSHARABLE_CLASS( CMusAvaClientResolverUtil ) : public CBase
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      */
       
    49     static CMusAvaClientResolverUtil* NewL();
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CMusAvaClientResolverUtil* NewLC();
       
    54 
       
    55     /**
       
    56     * Destructor.
       
    57     */
       
    58     virtual ~CMusAvaClientResolverUtil();
       
    59 
       
    60     /**
       
    61      * Register to SIP client resolver to be able to receive incoming sessions.
       
    62      *
       
    63      * @param aProfile
       
    64      */
       
    65     void RegisterClientWithUserL( CSIPProfile& aProfile ) const;
       
    66                 
       
    67     /**
       
    68      * Register to SIP client resolver to be able to receive incoming sessions.
       
    69      *
       
    70      * @param aImplementation UID of client who handles incoming session
       
    71      * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
       
    72      * @param aResolver UID of client resolver plug-in
       
    73      */
       
    74     void RegisterClientWithUserL(
       
    75                 const TUid& aImplementation,
       
    76                 const TDesC8& aProfileContactHeaderUser, 
       
    77                 const TUid& aResolver ) const;
       
    78 
       
    79     /**
       
    80      * Un-register from SIP client resolver to deny accepting incoming sessions.
       
    81      *
       
    82      * @param aProfile 
       
    83      */
       
    84     void UnRegisterClientWithUserL( CSIPProfile& aProfile ) const;
       
    85                 
       
    86     /**
       
    87      * Un-register from SIP client resolver to deny accepting incoming sessions.
       
    88      *
       
    89      * @param aImplementation UID of client who handles incoming session
       
    90      * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
       
    91      */
       
    92     void UnRegisterClientWithUserL(
       
    93                 const TUid& aImplementation,
       
    94                 const TDesC8& aProfileContactHeaderUser ) const;
       
    95 
       
    96 	 /**
       
    97      * Resolve implementation Uid for incoming session.
       
    98      *
       
    99      * @param aImplementation UID of client who handles incoming session
       
   100      * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
       
   101      */
       
   102     void GetImplementationUidWithUserL( 
       
   103         const TDesC8& aProfileContactHeaderUser,
       
   104         TUid& aImplementation ) const;
       
   105 
       
   106 
       
   107 private:
       
   108 
       
   109     /**
       
   110      * C++ default constructor.
       
   111      */
       
   112     CMusAvaClientResolverUtil();
       
   113 
       
   114     /**
       
   115      * By default Symbian 2nd phase constructor is private.
       
   116      */
       
   117     void ConstructL();
       
   118 
       
   119     /**
       
   120      * Finds all rows that match given search criterias.
       
   121      *
       
   122      * @param aImplementation UID of client who handles incoming session
       
   123      * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
       
   124      * @param aFoundKeys On return contains keys that matched requested rows
       
   125      * @return 
       
   126      */
       
   127     void GetClientWithUserL(
       
   128                 const TUid& aImplementation, 
       
   129                 const TDesC8& aProfileContactHeaderUser, 
       
   130                 RArray<TUint32>& aFoundKeys ) const;
       
   131                 
       
   132     /**
       
   133      * Creates unique key
       
   134      *
       
   135      * @param aNewKey New unique key to be used when inserting row to table
       
   136      * @return 
       
   137      */
       
   138     void CreateNewKeyL( TUint32& aNewKey ) const;
       
   139 
       
   140     /**
       
   141      * Gets Protocol Profile's User name from Contact header
       
   142      * @param aProfile
       
   143      * @param aContactHeaderUser
       
   144      * @return KErrNone if succeed.
       
   145      */                                     
       
   146     TInt GetContactHeaderUser( CSIPProfile& aProfile,
       
   147                                RBuf8& aContactHeaderUser ) const;
       
   148 
       
   149 
       
   150 private: // data
       
   151 
       
   152     /**
       
   153      * Instance of central repository
       
   154      * Own.
       
   155      */
       
   156     CRepository* iRepository;
       
   157 
       
   158     };
       
   159 
       
   160 #endif // C_SIPCLIENTRESOLVERUTILS_H