williamr@2: /* williamr@2: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Name : sipprofileregistrybase.h williamr@2: * Part of : SIP Profile Client williamr@2: * Interface : SDK API, SIP Profile API williamr@2: * The class for retrieving SIP profiles from permanent storage. williamr@2: * Version : 1.0 williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: #ifndef CSIPPROFILEREGISTRYBASE_H williamr@2: #define CSIPPROFILEREGISTRYBASE_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include "sipconcreteprofileobserver.h" williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CSIPProfile; williamr@2: class CSIPConcreteProfile; williamr@2: class TSIPProfileTypeInfo; williamr@2: class CSIPProfileCleanupItem; williamr@2: class CSIPProfileItem; williamr@2: class CSIPProfileITCReceiver; williamr@2: class CSIPProfileITC; williamr@2: class CSIPProfilePlugins; williamr@2: class MSIPProfileRegistryObserver; williamr@2: class RSIPProfile; williamr@2: class CSIPConcreteProfileHolder; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * @publishedAll williamr@2: * @released williamr@2: * williamr@2: * The class functions for retrieving SIP profiles from permanent storage. williamr@2: * It enables retrieval of single or more profiles from permanent williamr@2: * storage located in profile server. williamr@2: * williamr@2: * The class enables also the query of supported profile types. williamr@2: * williamr@2: * This class is an abstract class and cannot be instantiated. williamr@2: * williamr@2: * @lib sipprofilecli.lib williamr@2: */ williamr@2: class CSIPProfileRegistryBase: public CBase, public MSIPConcreteProfileObserver williamr@2: { williamr@2: public: // Constructors and destructor williamr@2: williamr@2: IMPORT_C ~CSIPProfileRegistryBase(); williamr@2: williamr@2: public: //new functions williamr@2: /** williamr@2: * Gets all SIP profiles williamr@2: * @pre aProfiles.Count() == 0 williamr@2: * @param aProfiles a reference to a client-owned array, which williamr@2: * on return is filled with all existing SIP profiles williamr@2: * @leave KErrNoMemory if out of memory williamr@2: * @capability ReadUserData williamr@2: */ williamr@2: IMPORT_C void ProfilesL(RPointerArray& aProfiles); williamr@2: williamr@2: /** williamr@2: * Gets all SIP profiles of particular type williamr@2: * The owneship of profiles are transferred. williamr@2: * @pre aProfiles.Count() == 0 williamr@2: * @param aType a SIP profile type that is used for a query williamr@2: * @param aProfiles a reference to a client-owned array, which williamr@2: * on return is filled with profiles of the given type. williamr@2: * @leave KErrNoMemory if out of memory williamr@2: * @capability ReadUserData williamr@2: */ williamr@2: IMPORT_C void ProfilesL( williamr@2: const TSIPProfileTypeInfo& aType, williamr@2: RPointerArray& aProfiles); williamr@2: williamr@2: /** williamr@2: * Gets SIP profile for a particular SIP AOR williamr@2: * The owneship of profiles are transferred. williamr@2: * @pre aProfiles.Count() == 0 williamr@2: * @param aAOR a SIP AOR e.g. user@domain.com williamr@2: * @param aProfiles a reference to a client-owned array, which williamr@2: * on return is filled with profiles of the given type. williamr@2: * @leave KErrNoMemory if out memory williamr@2: * @capability ReadUserData williamr@2: */ williamr@2: IMPORT_C void ProfilesL( williamr@2: const TDesC8& aAOR, williamr@2: RPointerArray& aProfiles); williamr@2: williamr@2: /** williamr@2: * Gets SIP profile identified by the Id williamr@2: * The owneship of profile is transferred. williamr@2: * @param aId a SIP profile Id williamr@2: * @return SIP profile williamr@2: * @leave KErrNotFound if profile is not found williamr@2: * @capability ReadUserData williamr@2: */ williamr@2: IMPORT_C CSIPProfile* ProfileL(TUint32 aId); williamr@2: williamr@2: /** williamr@2: * Gets the default profile williamr@2: * @return default profile; the owneship is transfered williamr@2: * @leave KErrNotFound if profile not found williamr@2: * @leave KErrNoMemory if out of memory williamr@2: * @capability ReadUserData williamr@2: */ williamr@2: IMPORT_C CSIPProfile* DefaultProfileL(); williamr@2: williamr@2: /** williamr@2: * Gets supported profile types williamr@2: * The owneship of returned objects are transferred. williamr@2: * @pre aSupportedProfileTypes.Count() == 0 williamr@2: * @param aSupportedProfileTypes a reference to client-owned array, williamr@2: * which on return is filled with supported profile types. williamr@2: * Any existing data in the array is destroyed. williamr@2: * @leave KErrNoMemory if out of memory williamr@2: */ williamr@2: IMPORT_C void SupportedProfileTypesL( williamr@2: RArray& aSupportedProfileTypes); williamr@2: williamr@2: /** williamr@2: * Gets the last occurred error during registration williamr@2: * @param aProfile williamr@2: * @return last occurred registration error, KErrNone if no error williamr@2: */ williamr@2: IMPORT_C TInt LastRegistrationError(const CSIPProfile& aProfile) const; williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Enable profile williamr@2: * @param aProfile to be enabled williamr@2: * @internalComponent williamr@2: */ williamr@2: void EnableProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Gets count of clients that have a profile enabled williamr@2: * @param aProfile profile to be checked williamr@2: * @return number of clients that have the profile enabled williamr@2: * @internalComponent williamr@2: */ williamr@2: TInt UsageL(const CSIPProfile& aProfile) const; williamr@2: williamr@2: /** williamr@2: * Disable profile williamr@2: * @param aProfile to be disabled williamr@2: * @internalComponent williamr@2: */ williamr@2: void DisableProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Force disable profile williamr@2: * All Profile related activities will be stopped ungracefully williamr@2: * @param aProfile to be disabled williamr@2: * @internalComponent williamr@2: */ williamr@2: void ForceDisableProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Add profile williamr@2: * @param aProfile to be added williamr@2: * @internalComponent williamr@2: */ williamr@2: void AddProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Update profile williamr@2: * @param aProfile to be updated williamr@2: * @internalComponent williamr@2: */ williamr@2: void UpdateProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Remove profile williamr@2: * @pre UsageL(aProfile) == 0 williamr@2: * @param aProfile to be removed williamr@2: * @internalComponent williamr@2: */ williamr@2: void RemoveProfileL(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Informs destruction of local profile object instance williamr@2: * @param aProfile instance of deleted profile williamr@2: * @internalComponent williamr@2: */ williamr@2: void ProfileDeleted(CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Checks whether profile is default or not williamr@2: * @param aProfile checked profile williamr@2: * @return ETrue if is default, otherwise EFalse williamr@2: * @internalComponent williamr@2: */ williamr@2: TBool IsDefaultProfileL(const CSIPProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Updates SIP profile value for negotiated security mechanism; leaves on failure williamr@2: * @param aProfile a SIP profile williamr@2: * @internalComponent williamr@2: */ williamr@2: void NegotiatedSecurityMechanismL(CSIPConcreteProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Updates SIP profile value for registered AORs; leaves on failure williamr@2: * @param aProfile a SIP profile williamr@2: * @internalComponent williamr@2: */ williamr@2: void RegisteredAORsL(CSIPConcreteProfile& aProfile); williamr@2: williamr@2: /** williamr@2: * Gets new instance of either type CSIPProfile or CSIPManagedProfile williamr@2: * @return new instance williamr@2: * @internalComponent williamr@2: */ williamr@2: virtual CSIPProfile* NewInstanceL() = 0; williamr@2: williamr@2: /** williamr@2: * Roll back in case of failure williamr@2: * @param aItem object to be cleaned williamr@2: * @internalComponent williamr@2: */ williamr@2: static void CrashRevert (TAny* aItem); williamr@2: williamr@2: /** williamr@2: * Roll back in case of failure williamr@2: * @param aItem object to be cleaned williamr@2: * @internalComponent williamr@2: */ williamr@2: static void LocalCrashRevert (TAny* aItem); williamr@2: williamr@2: /** williamr@2: * Gets the ITC member variable. williamr@2: * The owneship of ITC is not transferred. williamr@2: * @return Reference to ITC member variable. williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileITC& Itc(); williamr@2: williamr@2: /** williamr@2: * Gets the ITC receiver member variable. williamr@2: * The owneship of ITC receiver is not transferred. williamr@2: * @return Reference to ITC receiver member variable. williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileITCReceiver& ItcReceiver(); williamr@2: williamr@2: williamr@2: public: // From MSIPConcreteProfileObserver williamr@2: williamr@2: /** williamr@2: * SIP profile registration status changed event williamr@2: * @param aProfileId id of profile which registration williamr@2: * status has been changed. williamr@2: * @param aStatus new status of the profile williamr@2: * @param aStatusId id related to registration williamr@2: * @internalComponent williamr@2: */ williamr@2: void RegistrationStatusChangedL(TUint32 aProfileId, williamr@2: TInt aStatus, williamr@2: TUint32 aStatusId); williamr@2: williamr@2: /** williamr@2: * SIP profile creation event. williamr@2: * @param aProfileId id of new SIP Profile williamr@2: * @internalComponent williamr@2: */ williamr@2: void AddedL(TUint32 aProfileId); williamr@2: williamr@2: /** williamr@2: * SIP profile destruction event. williamr@2: * @param aProfileId id of profile which was destroyed williamr@2: * @internalComponent williamr@2: */ williamr@2: void RemovedL(TUint32 aProfileId); williamr@2: williamr@2: /** williamr@2: * SIP profile information update event williamr@2: * @param aProfileId id of updated SIP Profile williamr@2: * @param aSize size of updated SIP Profile williamr@2: * @internalComponent williamr@2: */ williamr@2: void UpdatedL(TUint32 aProfileId, TUint aSize); williamr@2: williamr@2: /** williamr@2: * An asynchronous error has occurred related to SIP profile williamr@2: * @param aProfileId the id of failed profile williamr@2: * @param aStatus williamr@2: * @param aError a error code williamr@2: * @internalComponent williamr@2: */ williamr@2: void ErrorOccurredL(TUint32 aProfileId, williamr@2: TInt aStatus, williamr@2: TInt aError); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Constructor williamr@2: * @param aObserver observer to send events to williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileRegistryBase(MSIPProfileRegistryObserver& aObserver); williamr@2: williamr@2: /** williamr@2: * Symbian 2nd phase base class constructor williamr@2: * @internalComponent williamr@2: */ williamr@2: void BaseConstructL(); williamr@2: williamr@2: /** williamr@2: * Store profile into client cache williamr@2: * @param aItem a cleanup item for roll back in case of failure williamr@2: * @internalComponent williamr@2: */ williamr@2: void StoreProfileL(CSIPProfileCleanupItem* aItem); williamr@2: williamr@2: /** williamr@2: * Store array of profiles into client cache williamr@2: * @param aProfiles a array containing the profiles williamr@2: * @param aRetProfiles returned array containing profiles williamr@2: * @internalComponent williamr@2: */ williamr@2: void StoreArrayL( williamr@2: RPointerArray& aProfiles, williamr@2: RPointerArray& aRetProfiles); williamr@2: williamr@2: /** williamr@2: * Gets profile cache item williamr@2: * @param aProfileId a profile id to be found williamr@2: * @return local cache item of the profile williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileItem* ProfileItemL(TUint aProfileId); williamr@2: williamr@2: /** williamr@2: * Gets profile cache item index williamr@2: * @param aProfileId a profile id to be found williamr@2: * @return local cache item index of the profile williamr@2: * @internalComponent williamr@2: */ williamr@2: TInt ProfileIndex (TUint aProfileId); williamr@2: williamr@2: /** williamr@2: * Gets profile cache item by index williamr@2: * @param aIndex a index of the profile to be found williamr@2: * @return local cache item of the profile williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileItem* ProfileItemByIndex(TUint aIndex); williamr@2: williamr@2: /** williamr@2: * Gets SIP profile identified by the Id; leaves on failure williamr@2: * The owneship of profile is transferred. williamr@2: * @param aId a SIP profile Id williamr@2: * @param aSize of profile if known williamr@2: * @return SIP profile or 0 pointer if there's no such SIP profile williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfile* SIPProfileL(TUint32 aId, TInt aSize = 0); williamr@2: williamr@2: protected: // Data williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: RSIPProfile* iSipClient; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileITCReceiver* iITCReceiver; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileITC* iITC; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: MSIPProfileRegistryObserver& iObserver; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: RPointerArray iProfiles; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfilePlugins* iProfilePlugins; williamr@2: williamr@2: /** williamr@2: * @internalComponent williamr@2: */ williamr@2: CSIPProfileItem* iFindEntry; williamr@2: williamr@2: private: williamr@2: williamr@2: void ProfilesCommonL(RPointerArray& aProfiles, williamr@2: CSIPConcreteProfileHolder* aHolder); williamr@2: williamr@2: }; williamr@2: williamr@2: #endif // CSIPPROFILEREGISTRYBASE_H