omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h
branchRCL_3
changeset 12 8a03a285ab14
parent 0 95b198f216e5
equal deleted inserted replaced
11:e16d72588c28 12:8a03a285ab14
    19 
    19 
    20 #ifndef CDCFREPSRV_H
    20 #ifndef CDCFREPSRV_H
    21 #define CDCFREPSRV_H
    21 #define CDCFREPSRV_H
    22 
    22 
    23 //  INCLUDES
    23 //  INCLUDES
    24 #include    <D32DBMS.H>
    24 #include    <d32dbms.h>
    25 #include <e32base.h>
    25 #include <e32base.h>
    26 #include "Pair.h"
    26 #include "Pair.h"
    27 #include "procwatcher.h"
    27 #include "procwatcher.h"
    28 
    28 
    29 // CONSTANTS
    29 // CONSTANTS
    38 enum TServerState
    38 enum TServerState
    39     {
    39     {
    40     EStateIdle = 0,
    40     EStateIdle = 0,
    41     EStateSetTtid,
    41     EStateSetTtid,
    42     EStateFullScan,
    42     EStateFullScan,
    43     EStateScan   
    43     EStateScan
    44     };
    44     };
    45 // FUNCTION PROTOTYPES
    45 // FUNCTION PROTOTYPES
    46 // FORWARD DECLARATIONS
    46 // FORWARD DECLARATIONS
    47 class CFileScan;
    47 class CFileScan;
    48 class COma2Dcf;
    48 class COma2Dcf;
    50 
    50 
    51 /**
    51 /**
    52 *  Server implementation.
    52 *  Server implementation.
    53 *  DCF Repository
    53 *  DCF Repository
    54 *
    54 *
    55 *  @lib 
    55 *  @lib
    56 *  @since Series 60 3.0 
    56 *  @since Series 60 3.0
    57 */
    57 */
    58 class CDcfRepSrv : public CServer2, public MWatcherObserver
    58 class CDcfRepSrv : public CServer2, public MWatcherObserver
    59     {
    59     {
    60     public:  // Constructors and destructor
    60     public:  // Constructors and destructor
    61         
    61 
    62         /**
    62         /**
    63         * Two-phased constructor.
    63         * Two-phased constructor.
    64         */
    64         */
    65         static CDcfRepSrv* NewLC();
    65         static CDcfRepSrv* NewLC();
    66         
    66 
    67         /**
    67         /**
    68         * Destructor.
    68         * Destructor.
    69         */
    69         */
    70         virtual ~CDcfRepSrv();
    70         virtual ~CDcfRepSrv();
    71 
    71 
    72     public: // New functions
    72     public: // New functions
    73         
    73 
    74         /**
    74         /**
    75         * Startup starts the actual server after initializing
    75         * Startup starts the actual server after initializing
    76         * the cleanup stack and active scheduler.
    76         * the cleanup stack and active scheduler.
    77         * @since S60Rel3.0
    77         * @since S60Rel3.0
    78         * @return system error code if error happens
    78         * @return system error code if error happens
    82         /**
    82         /**
    83         * AddFileL
    83         * AddFileL
    84         * @since Series 60 3.0
    84         * @since Series 60 3.0
    85         * @param aFile file name
    85         * @param aFile file name
    86         * @KErrNotSupported if file is not protected file
    86         * @KErrNotSupported if file is not protected file
    87         */        
    87         */
    88         void AddFileL( const TDesC& aFile );
    88         void AddFileL( const TDesC& aFile );
    89         
    89 
    90         /**
    90         /**
    91         * ProcessFile
    91         * ProcessFile
    92         * @since Series 60 3.0
    92         * @since Series 60 3.0
    93         * @param aFile file name
    93         * @param aFile file name
    94         * @param aFlag ETrue if the file satisfy to criteria of scanning target
    94         * @param aFlag ETrue if the file satisfy to criteria of scanning target
   100         * State
   100         * State
   101         * @since Series 60 3.0
   101         * @since Series 60 3.0
   102         * @return state of the server
   102         * @return state of the server
   103         */
   103         */
   104         TInt State() const;
   104         TInt State() const;
   105         
   105 
   106         /**
   106         /**
   107         * SetState
   107         * SetState
   108         * @since Series 60 3.0
   108         * @since Series 60 3.0
   109         * @param aMode server state
   109         * @param aMode server state
   110         * @return 
   110         * @return
   111         */
   111         */
   112         void SetState(TServerState aMode);
   112         void SetState(TServerState aMode);
   113         
   113 
   114         /**
   114         /**
   115         * CompleteScanning
   115         * CompleteScanning
   116         * @since Series 60 3.0
   116         * @since Series 60 3.0
   117         * @param aRet return code
   117         * @param aRet return code
   118         */
   118         */
   119         void CompleteScanning(TInt err);  
   119         void CompleteScanning(TInt err);
   120         
   120 
   121         
   121 
   122         /**
   122         /**
   123         * SetMessage
   123         * SetMessage
   124         * @since Series 60 3.0
   124         * @since Series 60 3.0
   125         * @param aMessage Message from client
   125         * @param aMessage Message from client
   126         */
   126         */
   127         RMessage2* SetMessageL(const RMessage2& aMessage);  
   127         RMessage2* SetMessageL(const RMessage2& aMessage);
   128         
   128 
   129         /**
   129         /**
   130         * Scan
   130         * Scan
   131         * @since Series 60 3.0
   131         * @since Series 60 3.0
   132         * @return error code
   132         * @return error code
   133         */            
   133         */
   134         TInt Scan();
   134         TInt Scan();
   135  
   135 
   136         /**
   136         /**
   137         * SetCidList
   137         * SetCidList
   138         * @since Series 60 3.0
   138         * @since Series 60 3.0
   139         * @param aList content ID list
   139         * @param aList content ID list
   140         */
   140         */
   141         void SetCidList(RPointerArray<HBufC8>*& aList);
   141         void SetCidList(RPointerArray<HBufC8>*& aList);
   142         
   142 
   143         
   143 
   144         /**
   144         /**
   145         * SetPairList
   145         * SetPairList
   146         * @since Series 60 3.0
   146         * @since Series 60 3.0
   147         * @param aList list of pairs for content ID and transaction ID
   147         * @param aList list of pairs for content ID and transaction ID
   148         */
   148         */
   149         void SetPairList(RPointerArray<CPair>*& aList);
   149         void SetPairList(RPointerArray<CPair>*& aList);
   150         
   150 
   151         /**
   151         /**
   152         * Stop watching the Rights Server
   152         * Stop watching the Rights Server
   153         * @since Series 60 3.1
   153         * @since Series 60 3.1
   154         */
   154         */
   155         void StopWatchingL();
   155         void StopWatchingL();
   156         
   156 
   157         /**
   157         /**
   158         * RemoveMessageL
   158         * RemoveMessageL
   159         * Called by destructor of the session class
   159         * Called by destructor of the session class
   160         */
   160         */
   161         void RemoveMessageL( const RMessage2* aMessage );
   161         void RemoveMessageL( const RMessage2* aMessage );
   162     
   162 
   163             
   163 
   164     public: // Functions from base classes
   164     public: // Functions from base classes
   165         
   165 
   166         //class MWatcherObserver
   166         //class MWatcherObserver
   167         
   167 
   168         /** 
   168         /**
   169          * Called when the peer process died
   169          * Called when the peer process died
   170          *
   170          *
   171          * @since S60 3.0
   171          * @since S60 3.0
   172          * @param aObject Changed object
   172          * @param aObject Changed object
   173          */
   173          */
   174         void WatchedObjectChangedL( const TDesC& aObject );
   174         void WatchedObjectChangedL( const TDesC& aObject );
   175         
   175 
   176     protected:  // New functions
   176     protected:  // New functions
   177         
   177 
   178     protected:  // Functions from base classes
   178     protected:  // Functions from base classes
   179         
   179 
   180         // Class CServer
   180         // Class CServer
   181         /** 
   181         /**
   182         * NewSessionL
   182         * NewSessionL
   183         * @since S60Rel3.0
   183         * @since S60Rel3.0
   184         */
   184         */
   185         CSession2* NewSessionL( const TVersion& aVersion,
   185         CSession2* NewSessionL( const TVersion& aVersion,
   186                                        const RMessage2& aMessage ) const;
   186                                        const RMessage2& aMessage ) const;
   187         
   187 
   188 
   188 
   189     private:
   189     private:
   190 
   190 
   191         /**
   191         /**
   192         * C++ default constructor.
   192         * C++ default constructor.
   198         */
   198         */
   199         void ConstructL();
   199         void ConstructL();
   200 
   200 
   201         /**
   201         /**
   202         * StartupL called by StartUp
   202         * StartupL called by StartUp
   203         * @since S60 Rel 3.0 
   203         * @since S60 Rel 3.0
   204         */
   204         */
   205         static void StartupL();
   205         static void StartupL();
   206 
   206 
   207         /**
   207         /**
   208         * PanicServer will panic with panic code
   208         * PanicServer will panic with panic code
   209         * @since S60 Rel 3.0 
   209         * @since S60 Rel 3.0
   210         */
   210         */
   211         static void PanicServer(TDcfRepSrvPanic aPanic);
   211         static void PanicServer(TDcfRepSrvPanic aPanic);
   212         
   212 
   213         /**
   213         /**
   214         * CleanScanInternal will clean list for Scan
   214         * CleanScanInternal will clean list for Scan
   215         * @since S60 Rel 3.0 
   215         * @since S60 Rel 3.0
   216         */        
   216         */
   217         void CleanScanInternal();
   217         void CleanScanInternal();
   218 
   218 
   219         /**
   219         /**
   220         * CleanDatabase will close database connection
   220         * CleanDatabase will close database connection
   221         * @since S60 Rel 3.0 
   221         * @since S60 Rel 3.0
   222         */        
   222         */
   223         void CleanDatabase();
   223         void CleanDatabase();
   224 
   224 
   225         /**
   225         /**
   226         * OpenDatabaseL will open database connection
   226         * OpenDatabaseL will open database connection
   227         * @since S60 Rel 3.0 
   227         * @since S60 Rel 3.0
   228         */          
   228         */
   229         void OpenDatabaseL();
   229         void OpenDatabaseL();
   230 
   230 
   231         /**
   231         /**
   232         * CleanTableL will clean all items in the table
   232         * CleanTableL will clean all items in the table
   233         * @since S60 Rel 3.0 
   233         * @since S60 Rel 3.0
   234         */           
   234         */
   235         void CleanTableL();
   235         void CleanTableL();
   236 
   236 
   237         /**
   237         /**
   238         * AddDomainRoL will add domain RO into file if there is any.
   238         * AddDomainRoL will add domain RO into file if there is any.
   239         * @since S60 Rel 3.0 
   239         * @since S60 Rel 3.0
   240         */         
   240         */
   241         void AddDomainRoL( const TDesC& aFile );
   241         void AddDomainRoL( const TDesC& aFile );
   242 
   242 
   243         /**
   243         /**
   244         * CheckFileL will check the file type: dcf1,dcf2,plain
   244         * CheckFileL will check the file type: dcf1,dcf2,plain
   245         * @since S60 Rel 3.0 
   245         * @since S60 Rel 3.0
   246         */             
   246         */
   247         void CheckFileL(const TDesC& aFile , TInt& aType);
   247         void CheckFileL(const TDesC& aFile , TInt& aType);
   248 
   248 
   249         /**
   249         /**
   250         * StoreFileL will store file info
   250         * StoreFileL will store file info
   251         * @since S60 Rel 3.0 
   251         * @since S60 Rel 3.0
   252         */          
   252         */
   253         void StoreFileL(const TDesC& aFile , TInt aType);
   253         void StoreFileL(const TDesC& aFile , TInt aType);
   254         
   254 
   255         /**
   255         /**
   256         * UpdateDatabaseL will store info into database
   256         * UpdateDatabaseL will store info into database
   257         * @since S60 Rel 3.0 
   257         * @since S60 Rel 3.0
   258         */         
   258         */
   259         void UpdateDatabaseL(
   259         void UpdateDatabaseL(
   260             const TDesC& aFile, 
   260             const TDesC& aFile,
   261             TInt aPos, 
   261             TInt aPos,
   262             const TDesC& aCid ,
   262             const TDesC& aCid ,
   263             const TDesC& aGroupId ,  
   263             const TDesC& aGroupId ,
   264             const TDesC& aTtid);
   264             const TDesC& aTtid);
   265 
   265 
   266         /**
   266         /**
   267         * ResetTtidL will write new ttid into file
   267         * ResetTtidL will write new ttid into file
   268         * @since S60 Rel 3.0 
   268         * @since S60 Rel 3.0
   269         */
   269         */
   270         void ResetTtidL(
   270         void ResetTtidL(
   271             const TDesC& aFile, 
   271             const TDesC& aFile,
   272             const TDesC8& aTtid
   272             const TDesC8& aTtid
   273             );
   273             );
   274 
   274 
   275         /**
   275         /**
   276         * ResetTtidL will write new ttid into file
   276         * ResetTtidL will write new ttid into file
   277         * @since S60 Rel 3.0 
   277         * @since S60 Rel 3.0
   278         */
   278         */
   279         void ResetTtidL(
   279         void ResetTtidL(
   280             COma2Dcf* aDcf, 
   280             COma2Dcf* aDcf,
   281             const TDesC8& aTtid
   281             const TDesC8& aTtid
   282             );        
   282             );
   283         // Prohibit copy constructor if not deriving from CBase.
   283         // Prohibit copy constructor if not deriving from CBase.
   284         CDcfRepSrv( const CDcfRepSrv& );
   284         CDcfRepSrv( const CDcfRepSrv& );
   285         // Prohibit assigment operator if not deriving from CBase.
   285         // Prohibit assigment operator if not deriving from CBase.
   286         CDcfRepSrv& operator=( const CDcfRepSrv& );
   286         CDcfRepSrv& operator=( const CDcfRepSrv& );
   287 
   287 
   297         RPointerArray<CPair>* iPairList;
   297         RPointerArray<CPair>* iPairList;
   298         RPointerArray<RMessage2> iMessageList;
   298         RPointerArray<RMessage2> iMessageList;
   299         TInt iState;
   299         TInt iState;
   300         CProcWatcher* iProcWatcher;
   300         CProcWatcher* iProcWatcher;
   301         TBool iArmed;
   301         TBool iArmed;
   302         
   302 
   303         // Reserved pointer for future extension
   303         // Reserved pointer for future extension
   304         TAny* iReserved;
   304         TAny* iReserved;
   305 
   305 
   306     public:     // Friend classes
   306     public:     // Friend classes
   307     protected:  // Friend classes
   307     protected:  // Friend classes
   308     private:    // Friend classes
   308     private:    // Friend classes
   309 
   309 
   310     };
   310     };
   311 
   311 
   312 #endif      // CDCFREPSRV_H   
   312 #endif      // CDCFREPSRV_H
   313             
   313 
   314 // End of File
   314 // End of File