policymanagement/dmutilserver/inc/DMUtilServer.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2000 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: Implementation of policymanagement components
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __DMUTIL_SERVER_H__
       
    20 #define __DMUTIL_SERVER_H__
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #ifdef __TARM_SYMBIAN_CONVERGENCY 
       
    25 #include <e32property.h>
       
    26 #else
       
    27 // nothing
       
    28 #endif
       
    29 
       
    30 #include <e32base.h>
       
    31 #include "DMUtilClient.h"
       
    32 
       
    33 // CONSTANTS
       
    34 #include "PMUtilInternalCRKeys.h"
       
    35 
       
    36 // ----------------------------------------------------------------------------------------
       
    37 // DMUtilServer server panic codes
       
    38 // ----------------------------------------------------------------------------------------
       
    39 enum TDMUtilPanic
       
    40 	{
       
    41 	EPanicGeneral,
       
    42 	EPanicIllegalFunction,
       
    43 	EBadDescriptor
       
    44 	};
       
    45 
       
    46 // MACROS
       
    47 // DATA TYPES
       
    48 // FUNCTION PROTOTYPES
       
    49 
       
    50 void PanicClient(const RMessagePtr2& aMessage,TDMUtilPanic aPanic);
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 class CRepository;
       
    54 class CACLStorage;
       
    55 
       
    56 // CLASS DECLARATION
       
    57 
       
    58 /**
       
    59 *  MDMCertNotifierCallback
       
    60 *  Description.
       
    61 */
       
    62 
       
    63 class MDMCertNotifierCallback
       
    64     {
       
    65     public: virtual void CertificateChangedL() = 0;
       
    66     public: virtual void NotifierErrorL( TInt aCode ) = 0;
       
    67     };
       
    68 
       
    69 /**
       
    70 *  CDMCertNotifier
       
    71 *  Description.
       
    72 */
       
    73 
       
    74 class CDMCertNotifier : public CActive
       
    75     {
       
    76 private:
       
    77 
       
    78 	enum TSessionCertStatus
       
    79 		{
       
    80 		ESessionCertContentZero,
       
    81 		ESessionCertHasChanged,
       
    82 		ESessionCertNoChange
       
    83 		};
       
    84 		
       
    85 public:
       
    86     CDMCertNotifier();
       
    87     ~CDMCertNotifier();
       
    88     void StartL( MDMCertNotifierCallback* aCallback );
       
    89     void RunL();
       
    90     void DoCancel();
       
    91 	void RunLToBeTrappedL();
       
    92 	
       
    93 	void SaveCertToCache();	
       
    94 	CDMCertNotifier::TSessionCertStatus GetCertStatus();
       
    95 	void ResetCertCache();
       
    96 	TBool IsEmpty( const TCertInfo& aCertInfo ) const;
       
    97 	TBool IsEqual( const TCertInfo& aCertInfo1, 
       
    98 				   const TCertInfo& aCertInfo2 ) const;
       
    99 	
       
   100 	TInt GetCert( TCertInfo& aCertInfo );
       
   101 	
       
   102 private:
       
   103     MDMCertNotifierCallback* iCallback;
       
   104 
       
   105 #ifdef __TARM_SYMBIAN_CONVERGENCY    
       
   106     RProperty iCertificateProperty;
       
   107 #else    
       
   108     CRepository* iRepository;
       
   109 #endif    
       
   110     // used to filter out unnecessary "certificate changed events"
       
   111     TCertInfo iCachedSessionCertificate;
       
   112     };
       
   113 
       
   114 /**
       
   115 *  CDMUtilServer
       
   116 *  Description.
       
   117 */
       
   118 
       
   119 class CDMUtilServer : public CPolicyServer, public MDMCertNotifierCallback
       
   120 	{
       
   121 	friend class CDMUtilSession;
       
   122 
       
   123 public:
       
   124     enum TPropertyDMCertKeys {EDMCert};
       
   125 
       
   126 	~CDMUtilServer();
       
   127 
       
   128 	static CServer2*    NewLC                   ();
       
   129 	void                Panic                   ( TInt aPanicCode );
       
   130 	void                CertificateChangedL     ();
       
   131     void                NotifierErrorL          ( TInt aCode );
       
   132 
       
   133 	static CACLStorage * ACLStorage();
       
   134 
       
   135 protected:
       
   136 	CSession2* NewSessionL(const TVersion&,const RMessage2&) const;
       
   137     CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
       
   138 
       
   139 private:
       
   140 	CDMUtilServer();
       
   141 	void                ConstructL              ();
       
   142 	void                UpdateSessionInfoL      ();
       
   143 	HBufC8*             GetServerIDL            ();
       
   144 	TInt                GetCertFromCentRep      ();
       
   145 	TInt                UpdateACLsL              ();
       
   146 	TBool 				IsSilentModeAllowed		();
       
   147 	HBufC8* 			GetServerIDFromSyncMLSessionL();
       
   148 	HBufC8* 			GetServerIDFromLocalCacheL();
       
   149 
       
   150 
       
   151 
       
   152 private:
       
   153 	// Server policy
       
   154 	#define DMUTILSERVER_NUMBER_OF_POLICIES 3
       
   155 	static CPolicyServer::TPolicy               iTcConnectionPolicy;
       
   156     static const TInt                           tcRanges[DMUTILSERVER_NUMBER_OF_POLICIES];
       
   157     static const TUint8                         tcElementsIndex[DMUTILSERVER_NUMBER_OF_POLICIES];
       
   158     static const CPolicyServer::TPolicyElement  tcElements[DMUTILSERVER_NUMBER_OF_POLICIES];
       
   159 	static TBool iManagementActive;
       
   160 
       
   161     TCertInfo iCertInfo;
       
   162     HBufC8*   iServerID;
       
   163     CDMCertNotifier iNotifier;
       
   164     static CACLStorage* iACLs;
       
   165 	};
       
   166 
       
   167 #endif //__DMUTIL_SERVER_H__