installationservices/swi/inc/swi/sisregistryentry.h
changeset 0 ba25891c3a9e
child 5 3eebb1e54d3a
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-2009 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 the License "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: 
       
    15 * SisRegistry - client registry entry(package) interface
       
    16 * Clients use the defined interface to access and querry information
       
    17 * specific to a single installed package.
       
    18 * The access to specific functionality depends on the client capabilities
       
    19 * and may be restricted.
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 /**
       
    25  @file
       
    26  @released
       
    27  @publishedPartner
       
    28 */
       
    29 
       
    30 #ifndef __SISREGISTRYENTRY_H__
       
    31 #define __SISREGISTRYENTRY_H__
       
    32 
       
    33 #include <e32std.h>
       
    34 #include <swi/sispackagetrust.h>
       
    35 
       
    36 class CX509Certificate;
       
    37 
       
    38 namespace Swi
       
    39 {
       
    40 class RSisRegistrySession;
       
    41 class CSisRegistryPackage;
       
    42 class CSisRegistryDependency;
       
    43 class CHashContainer;
       
    44 class TSisTrustStatus;
       
    45 
       
    46 /**
       
    47  * Client registry entry interface
       
    48  *
       
    49  * @publishedPartner
       
    50  * @released
       
    51  */
       
    52 class RSisRegistryEntry : public RSubSessionBase
       
    53 	{
       
    54 public:
       
    55 
       
    56 	/**
       
    57 	 * Opens the base package entry by specifying a UID.
       
    58 	 *
       
    59 	 * - A base package is a self-sufficient package which does
       
    60 	 * not depend on other packages with the same UID. It is also completely removed
       
    61 	 *  together with all related augmentation packages.
       
    62 	 *
       
    63 	 * - An agmentation package shares a UID with a base package and 'augments' the base package.
       
    64 	 * It can only be installed only when the related base package is installed
       
    65 	 * It can be uninstalled separatelly (without removing base package)
       
    66 	 *
       
    67 	 *
       
    68 	 * @param aSession	The open RSisRegistrySession to use
       
    69 	 * @param aUid		The UID identifying the entry
       
    70 	 * @return			KErrNone if successful, otherwise an error code
       
    71 	 */
       
    72 	IMPORT_C TInt Open(RSisRegistrySession &aSession, TUid aUid);
       
    73 
       
    74 	/**
       
    75 	 * Open a registry entry (includes augmentations) by specifying a package
       
    76 	 *
       
    77 	 * @param aSession The open RSisRegistrySession to use
       
    78 	 * @param aPackage The package to open
       
    79 	 *
       
    80 	 * @return KErrNone if successful, or an error code
       
    81 	 */
       
    82 	IMPORT_C TInt OpenL(RSisRegistrySession &aSession, const CSisRegistryPackage& aPackage);
       
    83 
       
    84 	/**
       
    85 	 * Open a registry entry (includes augmentations) by specifying a package
       
    86 	 * and vendor name.
       
    87 	 *
       
    88 	 * @param aSession		The open RSisRegistrySession to use
       
    89 	 * @param aPackageName	The name of the package
       
    90 	 * @param aVendorName	The name of the vendor
       
    91 	 * @return				KErrNone if successful, otherwise an error code
       
    92 	 */
       
    93 	IMPORT_C TInt Open(RSisRegistrySession &aSession, const TDesC& aPackageName, const TDesC& aVendorName);
       
    94 
       
    95 	/**
       
    96 	 * Closes the registry entry by closing the sub-session
       
    97 	 */
       
    98 	IMPORT_C void Close();
       
    99 
       
   100 	/**
       
   101 	 * Indicates whether the package is currently on the device (i.e. not on
       
   102 	 * removable media that is not inserted).
       
   103 	 *
       
   104 	 * @return	ETrue if the package is on the device;
       
   105 	 *			EFalse otherwise
       
   106 	 */
       
   107 	IMPORT_C TBool IsPresentL();
       
   108 
       
   109 	/**
       
   110 	 * Indicates whether the package is signed
       
   111 	 *
       
   112 	 * @return	ETrue the package is signed;
       
   113 	 *			EFalse otherwise
       
   114 	 */
       
   115 	IMPORT_C TBool IsSignedL();
       
   116 
       
   117 	/**
       
   118 	 * Indicates the level of trust associated with the package
       
   119 	 *
       
   120 	 * @return	The level of trust
       
   121 	 * @deprecated Will be replaced in the future by a more complete TrustStatusL method.
       
   122 	 */
       
   123 	IMPORT_C TSisPackageTrust TrustL() const;
       
   124 
       
   125 	/**
       
   126 	 * The time at which the trust level was established
       
   127 	 *
       
   128 	 * @return The time at which the trust level was established
       
   129 	 * @deprecated Will be replaced in the future by a more complete TrustStatusL method.
       
   130 	 */
       
   131 	IMPORT_C TTime TrustTimeStampL() const;
       
   132 
       
   133 
       
   134     /**
       
   135 	 * The trust status object for the entry. This supercedes information
       
   136 	 * provided by the deprecated TrustL and TrustTimeStampL methods.
       
   137 	 *
       
   138 	 * @return The trust status information associated with
       
   139 	 * this entry.
       
   140 	 */
       
   141 	IMPORT_C TSisTrustStatus TrustStatusL();
       
   142 
       
   143 	/**
       
   144 	 * Indicates whether or not the package is installed on read-only media
       
   145 	 *
       
   146 	 * 
       
   147 	 * @return	ETrue if any drive used by this package is read-only;
       
   148 	 *			EFalse otherwise
       
   149 	 */
       
   150 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK		 
       
   151 	/**
       
   152 	 * N.B. Using Usif::RSoftwareComponentRegistry::IsComponentOnReadOnlyDriveL 
       
   153 	 * will return different result when we have an empty ROM stub or when all 
       
   154 	 * the files of a ROM based package are eclipsed, since SCR only considers
       
   155 	 * the current list of files registered with it.
       
   156 	 */
       
   157 #endif
       
   158 	IMPORT_C TBool IsInRomL();
       
   159 
       
   160 
       
   161 
       
   162 	/**
       
   163 	 * Indicates whether or not the package augments another package
       
   164 	 *
       
   165 	 * @return	ETrue if the package is an augmentation;
       
   166 	 *			EFalse otherwise
       
   167 	 */
       
   168 	IMPORT_C TBool IsAugmentationL();
       
   169 
       
   170 	/**
       
   171 	 * Gets the version of this package
       
   172 	 *
       
   173 	 * @return	The version
       
   174 	 */
       
   175 	IMPORT_C TVersion VersionL();
       
   176 
       
   177 	/**
       
   178 	 * Gets the installed language for this package
       
   179 	 *
       
   180 	 * @return	The language
       
   181 	 */
       
   182 	IMPORT_C TLanguage LanguageL();
       
   183 
       
   184 	/**
       
   185 	 * Gets the UID of this package
       
   186 	 *
       
   187 	 * @return	The UID
       
   188 	 */
       
   189 	IMPORT_C TUid UidL();
       
   190 
       
   191 	/**
       
   192 	 * Gets the name of a package
       
   193 	 *
       
   194 	 * @return	The name of the package
       
   195 	 */
       
   196 	IMPORT_C HBufC* PackageNameL();
       
   197 
       
   198 	/**
       
   199 	 * Gets the unique vendor name of this package
       
   200 	 *
       
   201 	 * @return	The unique vendor name
       
   202 	 */
       
   203 	IMPORT_C HBufC* UniqueVendorNameL();
       
   204 
       
   205 	/**
       
   206 	 * Gets the localised vendor name of a package
       
   207 	 *
       
   208 	 * @return	The localised name of the vendor
       
   209 	 */
       
   210 	IMPORT_C HBufC* LocalizedVendorNameL();
       
   211 
       
   212 	/**
       
   213 	 * Returns an array of Sids (executables). The array is supplied by the
       
   214 	 * client which is then populated.
       
   215 	 *
       
   216 	 * @param aSids	 On return, the array object to be populated.
       
   217 	 */
       
   218 	IMPORT_C void SidsL(RArray<TUid>& aSids);
       
   219 
       
   220 	/**
       
   221 	 * Provides a list of files installed by this package. This function may also return
       
   222 	 * a file specification that contains wildcard characters ('?' and/or '*') if the 
       
   223 	 * package is a rom 'stub' sis file. Wildcard file specifications are NOT expanded and
       
   224 	 * in this instance, the Count() member function on 'aFiles' cannot be used as an
       
   225 	 * indicator of the number of files within the package.
       
   226 	 *
       
   227 	 * @param aFiles	The array of files to be populated.
       
   228 	 */
       
   229 	IMPORT_C void FilesL(RPointerArray<HBufC>& aFiles);
       
   230 
       
   231 	/**
       
   232      *  Returns the size of the installation excluding the size of
       
   233      *  other embedded packages
       
   234      *
       
   235      *  @return  A TInt64 value of the total installation size
       
   236      */
       
   237 	IMPORT_C TInt64 SizeL();
       
   238 
       
   239 	/**
       
   240 	 * Provides the certificate chains associated with this package
       
   241 	 *
       
   242 	 * @param aCertificateChains	The array of certificate chains
       
   243 	 */
       
   244 	IMPORT_C void CertificateChainsL(RPointerArray<HBufC8>& aCertificateChains);
       
   245 
       
   246 	/**
       
   247 	 * Gets the value of a property within a package
       
   248 	 *
       
   249 	 * @param aKey	The key to search for
       
   250 	 * @return		The value of this key if found;
       
   251 	                KErrNotFound otherwise.
       
   252 	 */
       
   253 	IMPORT_C TInt PropertyL(TInt aKey);
       
   254 
       
   255 	/**
       
   256 	 * Returns all augmentations to this package. If no augmentations exist,
       
   257 	 * the lists are empty
       
   258 	 *
       
   259 	 * @param aPackageNames	On return, a list of PackageNames
       
   260 	 * @param aVendorNames	On return, the corresponding list of VendorNames
       
   261 	 *
       
   262 	 */
       
   263 	IMPORT_C void AugmentationsL(RPointerArray<HBufC>& aPackageNames, RPointerArray<HBufC>& aVendorNames);
       
   264 
       
   265     /**
       
   266 	 * Returns all augmentations to this package. If no augmentations exist,
       
   267 	 * the list is empty
       
   268 	 *
       
   269 	 * @param aPackages The array of CSisRegistryPackages to be populated
       
   270 	 */
       
   271     IMPORT_C void AugmentationsL(RPointerArray<CSisRegistryPackage>& aPackages);
       
   272 	
       
   273 	/**
       
   274 	 * Gets the number of augmentations to this package.
       
   275 	 * @return the number of augmentations to this package
       
   276 	 */
       
   277 	IMPORT_C TInt AugmentationsNumberL();
       
   278 	
       
   279     /**
       
   280      *  Returns the hash value of a selected file, identified by its name
       
   281      *
       
   282      *  @param aFileName the full file path
       
   283      *  @return A new CHashContainer object
       
   284      */
       
   285 	IMPORT_C CHashContainer* HashL(const TDesC& aFileName);
       
   286 
       
   287 	 /**
       
   288 	 *  Returns the package of a current entry
       
   289 	 *
       
   290 	 *  @return A new CSisRegistryPackage object
       
   291 	 */
       
   292 	IMPORT_C CSisRegistryPackage* PackageL();
       
   293 
       
   294 	/**
       
   295 	 * Return the controllers associated with this package as raw binary data
       
   296 	 *
       
   297 	 * @param aControllers The array of controllers to be populated.
       
   298 	 *
       
   299 	 */
       
   300 	IMPORT_C void ControllersL(RPointerArray<HBufC8>& aControllers);
       
   301 
       
   302 	/**
       
   303 	 Returns what drive the user selected for files in the Sis file that
       
   304 	 did not specify drive.It returns KNoDriveSelected if user is not prompted for drive selection.
       
   305 	 For ROM stub packages it returns zero instead of KNoDriveSelected
       
   306 	 To determine the set of drives that files were installed to for this registry entry @see RSisRegistryEntry::InstalledDrivesL().
       
   307 	 @return TChar The drive selected
       
   308 	 @see KNoDriveSelected
       
   309 	 */
       
   310 	IMPORT_C TChar SelectedDriveL();
       
   311 
       
   312 	/**
       
   313 	Determines whether the base package or any of the partial upgrades
       
   314 	require all applications within this package to be to be shutdown before
       
   315 	uninstalling the package.
       
   316 
       
   317 	@return Whether to shutdown all applications at un-install.
       
   318 	*/
       
   319 	IMPORT_C TBool ShutdownAllAppsL();
       
   320 
       
   321 	/**
       
   322 	The function is used to re-verify the signature and certificate of the
       
   323 	SIS Controller associated to the RSisRegistryEntry object.
       
   324 
       
   325 	aX509CertArray parameter is used to give set of trusted root certificates
       
   326 	that are used for validation of the SIS Controller certificate. If the
       
   327 	set given as parameter is empty, Symbian implementation can fetch the
       
   328 	set of trusted root certificates from Certificate Management. If the set
       
   329 	is not empty, then root certificates should not be fetched from
       
   330 	Certificate Mgmt, but only the root certificates from the set given as
       
   331 	parameter should be used for SIS Controller certificate validation.
       
   332 
       
   333 	@param Array of trusted root certificates.
       
   334 	@return Returns ETrue if the registry entry is validated against the
       
   335 			trusted certificates provided.
       
   336 	*/
       
   337 	IMPORT_C TBool VerifyControllerSignatureL(RPointerArray<CX509Certificate>& aX509CertArray);
       
   338 
       
   339 	/**
       
   340 	The function is used to re-verify the signature and certificate of the
       
   341 	SIS Controller associated to the RSisRegistryEntry object.
       
   342 
       
   343 	aX509CertArray parameter is used to give set of trusted root certificates
       
   344 	that are used for validation of the SIS Controller certificate. If the
       
   345 	set given as parameter is empty, Symbian implementation can fetch the
       
   346 	set of trusted root certificates from Certificate Management. If the set
       
   347 	is not empty, then root certificates should not be fetched from
       
   348 	Certificate Mgmt, but only the root certificates from the set given as
       
   349 	parameter should be used for SIS Controller certificate validation.
       
   350 
       
   351 	@param aX509CertArray Array of trusted root certificates.
       
   352 	@param aCheckDateAndTime Indicates if the certificate validity period should be checked against the current date and time.
       
   353 	@return Returns ETrue if the registry entry is validated against the
       
   354 			trusted certificates provided.
       
   355 	*/
       
   356 	IMPORT_C TBool VerifyControllerSignatureL(RPointerArray<CX509Certificate>& aX509CertArray, TBool aCheckDateAndTime);
       
   357 
       
   358 	/**
       
   359 	Indicates whether or not the package will be removed by uninstalling the last dependant
       
   360 	*/
       
   361 	IMPORT_C TInt RemoveWithLastDependentL();
       
   362 
       
   363 	/**
       
   364 	This function is used to indicate the embedding package has been uninstalled but
       
   365 	this package remained because of dependency.
       
   366 	*/
       
   367 	IMPORT_C void SetRemoveWithLastDependentL(TUid uid);
       
   368 
       
   369 	/**
       
   370 	 * @return true if the 'non-removable' flag is NOT set in the SisInfo object
       
   371 	 * belonging to this package.
       
   372 	 */
       
   373 	IMPORT_C TBool RemovableL();
       
   374 	
       
   375 	/**
       
   376 	 Returns set of drives to which files were installed in SIS file
       
   377 	 @return Returns The bitmask of drives is as follows:
       
   378 		Bit 0 -> A drive  
       
   379 		Bit 1 -> B drive  
       
   380 		so on and so forth.
       
   381 	*/
       
   382 	IMPORT_C TUint InstalledDrivesL();
       
   383 	
       
   384 	/**
       
   385 	 * Returns whether or not the package was pre-installed
       
   386 	 *
       
   387 	 * @return ETrue if the package was pre-installed
       
   388 	 *         EFalse otherwise
       
   389 	 */
       
   390 	IMPORT_C TBool PreInstalledL();
       
   391 	
       
   392 	/**
       
   393 	* Returns whether or not the package was pre-installed and files should
       
   394 	* be deleted on uninstall.  This will have been set true if and only if
       
   395 	* the swipolicy indicates that preinstalled files can be deleted, and the
       
   396 	* stub sis file used to install the package was writable at install time.
       
   397 	*
       
   398 	* @return ETrue if the package was pre-installed and files should be
       
   399 	*               deleted on uninstall.
       
   400 	*         EFalse otherwise
       
   401 	*/
       
   402 	IMPORT_C TBool IsDeletablePreInstalledL();
       
   403 	
       
   404 		
       
   405 	/**
       
   406 	* Returns the array of packages which are either dependent on this package or are
       
   407 	* augmentations of this package.
       
   408 	*
       
   409 	* @note 
       
   410 	* A is a "Dependent" of B if B is in A's dependency list
       
   411 	* A is a "dependency" of B if A is in B's dependency list
       
   412 	* For example consider a package Shared_library_B which is used by a package App_A. 
       
   413 	* Shared_Library_B will be listed as a dependency in the sis file which installs App_A 
       
   414 	* App_A cannot be installed successfully without Shared_Library_B being present. 
       
   415 	* If Shared_Library_B is un-installed App_A may not function correctly.  
       
   416 	* App_A is a "dependent" of Shared_library_B
       
   417 	* Shared_library_B is a "dependency" of App_A
       
   418 	*
       
   419 	* @param aDependents The array of packages which are either dependent on this package  
       
   420 	* or are augmentations of this package (i.e. its dependents)
       
   421 	*
       
   422 	*/
       
   423 	IMPORT_C void DependentPackagesL(RPointerArray<CSisRegistryPackage>& aDependents);
       
   424 	
       
   425 	/**
       
   426 	* Returns the dependency array for this package (ie the packages, denoted 
       
   427 	* by UID and the version ranges it depends on).
       
   428 	*
       
   429 	* @note 
       
   430 	* A is a "Dependent" of B if B is in A's dependency list
       
   431 	* A is a "dependency" of B if A is in B's dependency list
       
   432 	* For example consider a package Shared_library_B which is used by a package App_A. 
       
   433 	* Shared_Library_B will be listed as a dependency in the sis file which installs App_A 
       
   434 	* App_A cannot be installed successfully without Shared_Library_B being present. 
       
   435 	* If Shared_Library_B is un-installed App_A may not function correctly.
       
   436 	* In this scenario 
       
   437 	* App_A is a "dependent" of Shared_library_B
       
   438 	* Shared_library_B is a "dependency" of App_A
       
   439 	*
       
   440 	* @param aDependencies The array of packages that this package depends on (i.e. its dependencies)
       
   441 	*
       
   442 	*/
       
   443 	IMPORT_C void DependenciesL(RPointerArray<CSisRegistryDependency>& aDependencies);
       
   444 
       
   445 	/**
       
   446 	* For a given package entry, return a array of packages that were
       
   447 	* embedded within this package.
       
   448 	*
       
   449 	* @param aEmbedded The array of embedded packages
       
   450 	*
       
   451 	*/
       
   452 	IMPORT_C void EmbeddedPackagesL(RPointerArray<CSisRegistryPackage>& aEmbedded);
       
   453 		
       
   454 	/**
       
   455 	* For a given package entry, return a array of packages that 
       
   456 	* embed it. 
       
   457 	* Note: This is possible when package A embeds D and the subsequently installed packages
       
   458 	*       B and C each in turn embed D. As there will be a single copy and a single 
       
   459 	*       registration for D, it is imperative this back information is retained 
       
   460 	*       and it is accessible.
       
   461 	*
       
   462 	* @param aEmbedding The array of embedding packages
       
   463 	*
       
   464 	*/
       
   465 	IMPORT_C void EmbeddingPackagesL(RPointerArray<CSisRegistryPackage>& aEmbedding);
       
   466 	
       
   467 	/**
       
   468 	* Returns ETrue if the SIS package is signed by a certificate trusted by the device (SU)
       
   469 	* for eclipsing of files on the Z drive
       
   470 	*
       
   471 	*/
       
   472 	IMPORT_C TBool IsSignedBySuCertL();
       
   473 		
       
   474 protected:
       
   475 	/**
       
   476      * @internalComponent
       
   477 	 */
       
   478 	HBufC8* SendReceiveBufferLC(TInt aMessage);
       
   479 	/**
       
   480      * @internalComponent
       
   481 	 */
       
   482 	HBufC8* SendReceiveBufferLC(TInt aMessage, const TDesC& aInputDescriptor);
       
   483 	};
       
   484 
       
   485 } // namespace
       
   486 #endif