diff -r 000000000000 -r 094583676ce7 PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationManager.h Thu Dec 17 08:41:52 2009 +0200 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Reactive authorization manager. +* +*/ + +#ifndef __CPENGAUTHORIZATIONMANAGER_H__ +#define __CPENGAUTHORIZATIONMANAGER_H__ + + +// INCLUDES +#include +#include "CPEngAuthorizationEngine.h" +#include "MPEngAuthorizationManager.h" +#include "MPEngAuthorizationManagerSet.h" + + +// FORWARD DECLARATIONS +class CPEngAuthorizationRequest; + +// CLASS DECLARATION +/** + * Reactive authorization manager. + * Provides interface to access all active authorizations. + * + * @lib PEngListLib2 + * @since 3.0 + */ +class CPEngAuthorizationManager : public CPEngAuthorizationEngine, + public MPEngAuthorizationManager, + public MPEngAuthorizationManagerSet + + { + public: // Constructors and destructor + + /** + * Two-phased constructor, + */ + static CPEngAuthorizationManager* NewLC( MPEngListLibFactory& aFactory, + const CPEngSessionSlotId& aSessionId ); + + /** + * Destructor. + */ + virtual ~CPEngAuthorizationManager(); + + + public: // From MPEngAuthorizationManager + + /** + * Close reference + * @see + */ + void Close(); + + + /** + * Count all authorizations + * @see + */ + TInt AuthorizationsCount() const; + + + /** + * Get authorization request + * @see + */ + MPEngAuthorizationRequest& Authorization( TInt aIndex ); + + + /** + * Count pending authorizations request + * @see + */ + TInt PendingAuthorizationsCount() const; + + + /** + * Get pending authorizations request + * @see + */ + MPEngAuthorizationRequest& PendingAuthorization( TInt aIndex ); + + + /** + * Issued authorization status count + * @see + */ + TInt RespondedAuthorizationsCount() const; + + + /** + * Issued authorization status + * @see + */ + const MPEngAuthorizationStatus& RespondedAuthorization( + TInt aIndex ) const; + + + /** + * Server denied authorizations count + * @see + */ + TInt ServerDeniedAuthorizationsCount() const; + + /** + * Server denied authorization + * @see + */ + const MPEngAuthorizationStatus& ServerDeniedAuthorization( + TInt aIndex ) const; + + /** + * Remove all Authorization responses + * @see + */ + void RemoveAllAuthorizationResponses(); + + + /** + * Buffer with all packed authorization responses. + * @see + */ + HBufC16* BufferedTransactionsLC(); + + + /** + * Register authorization observer. + * @see + */ + void RegisterAuthorizationObserverL( + MPEngAuthorizationObserver& aObserver ); + + /** + * Unregister authorization observer. + * @see + */ + void UnRegisterAuthorizationObserver( + MPEngAuthorizationObserver& aObserver ); + + + + protected: // From MPEngAuthorizationManagerSet + + /** + * Set authorization response + * + * @see + */ + void SetAuthorizedAttributesL( + const CPEngAuthorizationRequest& aAuthRequest, + TArray& aAttributes, + TBool aKeepOldAuthorization ); + + void DenyAuthorizationL( const TDesC& aUserId ); + void CancelAuthorizationL( const TDesC& aUserId ); + + + /** + * Removes buffered authorization response + * @see + */ + void RemoveAuthorizationResponse( const TDesC& aUserId ); + + + private: //From CPEngStoreEntry / MPEngSIDChangeObserver + + /** + * Handle change of the Storage IDs + * @see + */ + void HandleSIDsChangeL( CPtrCArray& aChangedSIDs ); + + /** + * Called when SIDs notifier fails + * @see + */ + void HandleSIDNotifyError( TInt aError ); + + + private: // new functions + + /** + * Rebuild array of pending and denied authorizations + * + * @since 3.0 + */ + void RebuildSupportingArraysL(); + + + /** + * Notify observers about events + * + * @since 3.0 + */ + void NotifyAllChangesToObservers(); + + + /** + * Notify observers about events + * + * @since 3.0 + */ + template + void NotifyChangeToObservers( + void ( MPEngAuthorizationObserver:: *aNotifFunc )( NotifyItem& ), + NotifyItem& aArgument ); + + /** + * Set all flags as to be notified + * + * @since 3.0 + */ + void UpdateAllFlags(); + + + /** + * Get Authorization response. + * + * @since 3.0 + * @param aUserId user id of the Authorization response + * @return authorization response + */ + CPEngAuthorizationResponse& AuthorizationResponseL( + const TDesC& aUserId ); + + + /** + * Enable lock + * + * @since 3.0 + * @return ETrue if lock is put to clean up stack + */ + TBool EnableLockLC(); + + + /** + * Release lock + * + * @since 3.0 + */ + void ReleaseLock(); + + + public: // Lock clean up support + + /** + * Handle release event + * Used for Lock clean up stack support + * + * @since 3.0 + */ + void Release(); + + + private: + + /** + * C++ constructor. + */ + CPEngAuthorizationManager( MPEngListLibFactory& aFactory ); + + /** + * Symbian constructor + */ + void ConstructL( const CPEngSessionSlotId& aSessionSlot ); + + + private: // Data + + /// OWN: Buffered authorization responses + /// Elements OWN + RPointerArray iResponses; + + /// OWN: Pending authorizations, + // Elements REFerenced + RPointerArray iPendingAuth; + + /// OWN: Denied authorization + /// Elements REFerenced + RPointerArray iDeniedAuth; + + + /// REF: Authorization Observers + RPointerArray iObservers; + + + /// OWN: Size of the buffered responses + TInt iBufRespSize; + + }; + +#endif // __CPENGAUTHORIZATIONMANAGER_H__ + +// End of File + + + + + + + + + + + + + + + + + + + + + +