sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef POLICY_H sl@0: #define POLICY_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: namespace UserPromptService sl@0: { sl@0: /** sl@0: Defines a set of SID classes. sl@0: See Symbian Signed UID FAQ for the definition of SID classes. sl@0: */ sl@0: NONSHARABLE_CLASS(TSidClasses) sl@0: { sl@0: public: sl@0: IMPORT_C TSidClasses(TUint16 aSidClasses); sl@0: IMPORT_C TBool Contains(const TSecureId& aSid) const; sl@0: sl@0: const TUint16 iSidClasses; ///< A bitmask that defines the set SID classes. sl@0: }; sl@0: sl@0: /** sl@0: Class for a single policy record. sl@0: */ sl@0: NONSHARABLE_CLASS(CPolicy) : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Defines the elements in the options field that determines sl@0: whether a prompt should be displayed and if so what buttons are sl@0: available. sl@0: sl@0: All other bits are reserved for future use and should be ignored sl@0: by the custom Policy Evaluators and Dialog Creators. sl@0: */ sl@0: typedef enum sl@0: { sl@0: EYes = 0x01, ///< The 'Yes' button should be displayed in the prompt. sl@0: ENo = 0x02, ///< The 'No' button should be displayed in the prompt. sl@0: ESession = 0x04, ///< The 'SessionYes' button should be displayed in the prompt. sl@0: ESessionYes = 0x04, ///< The 'SessionYes' button should be displayed in the prompt. sl@0: EAlways = 0x08, ///< The 'Always' button should be displayed in the prompt. sl@0: ENever = 0x10, ///< The 'Never' button should be displayed in the prompt. sl@0: ESessionNo = 0x20 ///< The 'SessionNo' button should be displayed in the prompt. sl@0: } TOptions; sl@0: sl@0: /** sl@0: Allows policies to be matched according to whether the client process sl@0: passed security check defined by the system server. sl@0: Typically, this corresponds to whether the client has the correct capabilities sl@0: for the requested service. However, system servers are free to use features sl@0: other than capabilities in their security check. sl@0: sl@0: E.g. If the client has the correct capabilities for the requested service then sl@0: the "Always" and "Never" options will be enabled in the policy; otherwise, a sl@0: different policy will be matched where the prompt is limited to one-shot sl@0: permissions ("Yes" and "No"). sl@0: */ sl@0: typedef enum sl@0: { sl@0: /** sl@0: The policy applies regardless of whether the client process passed the sl@0: system server's security check. sl@0: */ sl@0: ESystemServerSecurityPassedOrFailed = 0, sl@0: /** sl@0: The policy only applies if the client process failed the system server's sl@0: security check. sl@0: */ sl@0: ESystemServerSecurityFailed = 1, sl@0: /** sl@0: The policy only applies if the client process passed the system server's sl@0: security check. sl@0: */ sl@0: ESystemServerSecurityPassed = 2 sl@0: } TSystemServerSecurity; sl@0: sl@0: IMPORT_C static CPolicy* NewL(const TSidClasses& aSidClasses, const RArray& aSidList, sl@0: const TDesC& aDestination, TUint aOptions, const TUid& aPolicyEvaluator, sl@0: const TUid& aDialogCreator, TUint16 aFlags, sl@0: TSystemServerSecurity aSystemServerSecurity, sl@0: TUint16 aMajorVersion, TUint16 aMinorVersion, TBool aDefault = EFalse); sl@0: sl@0: IMPORT_C static CPolicy* NewLC(const TSidClasses& aSidClasses, const RArray& aSidList, sl@0: const TDesC& aDestination, TUint aOptions, const TUid& aPolicyEvaluator, sl@0: const TUid& aDialogCreator, TUint16 aFlags, sl@0: TSystemServerSecurity aSystemServerSecurity, sl@0: TUint16 aMajorVersion, TUint16 aMinorVersion, TBool aDefault = EFalse); sl@0: sl@0: IMPORT_C TBool Matches(const TSecureId& aClientSid, const TDesC& aDestination, TBool aSecurityResult) const; sl@0: IMPORT_C TBool PromptRequired() const; sl@0: sl@0: IMPORT_C TOptions Options() const; sl@0: IMPORT_C const TUid& PolicyEvaluator() const; sl@0: IMPORT_C const TUid& DialogCreator() const; sl@0: IMPORT_C const TDesC& Destination() const; sl@0: IMPORT_C const TSidClasses& SidClasses() const; sl@0: IMPORT_C const RArray& SidList() const; sl@0: IMPORT_C TUint16 Flags() const; sl@0: IMPORT_C TBool Default() const; sl@0: IMPORT_C TSystemServerSecurity SystemServerSecurity() const; sl@0: IMPORT_C TUint16 MajorVersion() const; sl@0: IMPORT_C TUint16 MinorVersion() const; sl@0: sl@0: ~CPolicy(); sl@0: private: sl@0: CPolicy(const TSidClasses& aSidClasses, TUint aOptions, sl@0: const TUid& aPolicyEvaluator, const TUid& aDialogCreator, sl@0: TUint16 aFlags, TSystemServerSecurity aSystemServerSecurity, sl@0: TUint16 aMajorVersion, TUint16 aMinorVersion, TBool aDefault); sl@0: sl@0: void ConstructL(const RArray& aSidList, const TDesC& aDescription); sl@0: sl@0: TSidClasses iSidClasses; ///< The clases of SIDs that this policy applies to. sl@0: RArray iSidList; ///< The set of individual SIDs that this policy applies to. sl@0: HBufC* iDestination; ///< Wildcard string to match against the request's destination. sl@0: TUint iOptions; ///< Options for evaluator EYes|ENo|ESessionYes|EAlways|ENever. sl@0: TUid iPolicyEvaluator; ///< Implementation UID of the associated policy evaluator. sl@0: TUid iDialogCreator; ///< Implementation UID of the associated dialog creator. sl@0: TUint16 iFlags; ///< Policy Evaluator specific flags sl@0: /** Whether this policy is specific to clients that passed/failed the system server's sl@0: security check. */ sl@0: TSystemServerSecurity iSystemServerSecurity; sl@0: TUint16 iMajorVersion; ///< Major version of the UPS policy file. sl@0: TUint16 iMinorVersion; ///< Minor version of the UPS policy file. sl@0: TBool iDefault; ///< ETrue if no match was found in the policy file. sl@0: }; sl@0: } sl@0: sl@0: #endif // POLICY_H