backupandrestore/backupengine/src/sbtypes.cpp
changeset 47 63cf70d3ecd8
parent 33 883e91c086aa
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    22 #include "sbepanic.h"
    22 #include "sbepanic.h"
    23 #include "sbtypes.h"
    23 #include "sbtypes.h"
    24 #include <s32mem.h>
    24 #include <s32mem.h>
    25 #include <apgcli.h>
    25 #include <apgcli.h>
    26 #include <apmstd.h>
    26 #include <apmstd.h>
       
    27 #include "OstTraceDefinitions.h"
       
    28 #include "sbtrace.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "sbtypesTraces.h"
       
    31 #endif
    27 
    32 
    28 namespace conn
    33 namespace conn
    29 	{
    34 	{	
    30 	
       
    31 	EXPORT_C CDataOwnerInfo* CDataOwnerInfo::NewL( CSBGenericDataType* aGenericDataType,
    35 	EXPORT_C CDataOwnerInfo* CDataOwnerInfo::NewL( CSBGenericDataType* aGenericDataType,
    32 										  TCommonBURSettings aCommonSettings,
    36 										  TCommonBURSettings aCommonSettings,
    33 										  TPassiveBURSettings aPassiveSettings,
    37 										  TPassiveBURSettings aPassiveSettings,
    34 										  TActiveBURSettings aActiveSettings,
    38 										  TActiveBURSettings aActiveSettings,
    35 										  const TDriveList& aDriveList )
    39 										  const TDriveList& aDriveList )
    43 	@param aActiveSettings flags for storing active backup and restore settings
    47 	@param aActiveSettings flags for storing active backup and restore settings
    44 	@param aDriveList the array of drives the data owner has data on
    48 	@param aDriveList the array of drives the data owner has data on
    45 	@return A pointer to the CDataOwnerInfo object
    49 	@return A pointer to the CDataOwnerInfo object
    46 	*/
    50 	*/
    47 		{
    51 		{
       
    52 		OstTraceFunctionEntry0( CDATAOWNERINFO_NEWL_ENTRY );
    48 		CDataOwnerInfo* self = new(ELeave) CDataOwnerInfo();
    53 		CDataOwnerInfo* self = new(ELeave) CDataOwnerInfo();
    49 		CleanupStack::PushL(self);
    54 		CleanupStack::PushL(self);
    50 		self->ConstructL(aGenericDataType, aCommonSettings, aPassiveSettings, aActiveSettings, aDriveList);
    55 		self->ConstructL(aGenericDataType, aCommonSettings, aPassiveSettings, aActiveSettings, aDriveList);
    51 		CleanupStack::Pop(self);
    56 		CleanupStack::Pop(self);
       
    57 		OstTraceFunctionExit0( CDATAOWNERINFO_NEWL_EXIT );
    52 		return self;
    58 		return self;
    53 		}
    59 		}
    54 
    60 
    55 	EXPORT_C CDataOwnerInfo* CDataOwnerInfo::NewL( const TDesC8& aFlatDataOwnerInfo )
    61 	EXPORT_C CDataOwnerInfo* CDataOwnerInfo::NewL( const TDesC8& aFlatDataOwnerInfo )
    56 	/**
    62 	/**
    59 
    65 
    60 	@param aFlatDataOwnerInfo a flat data owner info returned from IPC
    66 	@param aFlatDataOwnerInfo a flat data owner info returned from IPC
    61 	@return A pointer to the CDataOwnerInfo object
    67 	@return A pointer to the CDataOwnerInfo object
    62 	*/
    68 	*/
    63 		{
    69 		{
       
    70 		OstTraceFunctionEntry0( DUP1_CDATAOWNERINFO_NEWL_ENTRY );
    64 		CDataOwnerInfo* self = new(ELeave) CDataOwnerInfo();
    71 		CDataOwnerInfo* self = new(ELeave) CDataOwnerInfo();
    65 		CleanupStack::PushL(self);
    72 		CleanupStack::PushL(self);
    66 		self->ConstructL(aFlatDataOwnerInfo);
    73 		self->ConstructL(aFlatDataOwnerInfo);
    67 		CleanupStack::Pop(self);
    74 		CleanupStack::Pop(self);
       
    75 		OstTraceFunctionExit0( DUP1_CDATAOWNERINFO_NEWL_EXIT );
    68 		return self;
    76 		return self;
    69 		}
    77 		}
    70 	
    78 	
    71 	CDataOwnerInfo::CDataOwnerInfo()
    79 	CDataOwnerInfo::CDataOwnerInfo()
    72 	/**
    80 	/**
    73 	C++ Constructor 
    81 	C++ Constructor 
    74 	*/
    82 	*/
    75 		{
    83 		{
       
    84 		OstTraceFunctionEntry0( CDATAOWNERINFO_CDATAOWNERINFO_CONS_ENTRY );
       
    85 		OstTraceFunctionExit0( CDATAOWNERINFO_CDATAOWNERINFO_CONS_EXIT );
    76 		}
    86 		}
    77 
    87 
    78 	EXPORT_C CDataOwnerInfo::~CDataOwnerInfo()
    88 	EXPORT_C CDataOwnerInfo::~CDataOwnerInfo()
    79 	/**
    89 	/**
    80 	C++ Destructor
    90 	C++ Destructor
    81 	*/
    91 	*/
    82 		{
    92 		{
       
    93 		OstTraceFunctionEntry0( CDATAOWNERINFO_CDATAOWNERINFO_DES_ENTRY );
    83 		delete iGenericDataType;
    94 		delete iGenericDataType;
       
    95 		iGenericDataType = NULL;
       
    96 		OstTraceFunctionExit0( CDATAOWNERINFO_CDATAOWNERINFO_DES_EXIT );
    84 		}
    97 		}
    85 
    98 
    86 	void CDataOwnerInfo::ConstructL(CSBGenericDataType* aGenericDataType,
    99 	void CDataOwnerInfo::ConstructL(CSBGenericDataType* aGenericDataType,
    87 									TCommonBURSettings aCommonSettings,
   100 									TCommonBURSettings aCommonSettings,
    88 									TPassiveBURSettings aPassiveSettings,
   101 									TPassiveBURSettings aPassiveSettings,
    96 	@param aPassiveSettings flags for storing passive backup and restore settings
   109 	@param aPassiveSettings flags for storing passive backup and restore settings
    97 	@param aActiveSettings flags for storing active backup and restore settings
   110 	@param aActiveSettings flags for storing active backup and restore settings
    98 	@param aDriveList the array of drives the data owner has data on
   111 	@param aDriveList the array of drives the data owner has data on
    99 	*/
   112 	*/
   100 		{
   113 		{
       
   114 		OstTraceFunctionEntry0( CDATAOWNERINFO_CONSTRUCTL_ENTRY );
   101 		if (aGenericDataType == NULL)
   115 		if (aGenericDataType == NULL)
   102 			{
   116 			{
       
   117 		    OstTrace0(TRACE_ERROR, CDATAOWNERINFO_CONSTRUCTL, "Leave: KErrArgument");
   103 			User::Leave(KErrArgument);
   118 			User::Leave(KErrArgument);
   104 			}
   119 			}
   105 		iGenericDataType = aGenericDataType;
   120 		iGenericDataType = aGenericDataType;
   106 		iCommonBURSettings = aCommonSettings;
   121 		iCommonBURSettings = aCommonSettings;
   107 		iPassiveBURSettings = aPassiveSettings;
   122 		iPassiveBURSettings = aPassiveSettings;
   108 		iActiveBURSettings = aActiveSettings;
   123 		iActiveBURSettings = aActiveSettings;
   109 		iDriveList = aDriveList;
   124 		iDriveList = aDriveList;
       
   125 		OstTraceFunctionExit0( CDATAOWNERINFO_CONSTRUCTL_EXIT );
   110 		}
   126 		}
   111 
   127 
   112 	void CDataOwnerInfo::ConstructL(const TDesC8& aFlatDataOwnerInfo)
   128 	void CDataOwnerInfo::ConstructL(const TDesC8& aFlatDataOwnerInfo)
   113 	/**
   129 	/**
   114 	Symbian OS 2nd phase constructor. Internalise a descriptor containing a flattened 
   130 	Symbian OS 2nd phase constructor. Internalise a descriptor containing a flattened 
   115 	object of this type
   131 	object of this type
   116 
   132 
   117 	@param aFlatDataOwnerInfo a flat data owner info returned from IPC
   133 	@param aFlatDataOwnerInfo a flat data owner info returned from IPC
   118 	*/
   134 	*/
   119 		{
   135 		{
       
   136 		OstTraceFunctionEntry0( DUP1_CDATAOWNERINFO_CONSTRUCTL_ENTRY );
   120 		// TPtr8 that points to aFlatDataOwnerInfo (which remains const)
   137 		// TPtr8 that points to aFlatDataOwnerInfo (which remains const)
   121 		TPtr8 pSource(const_cast<TUint8*>(aFlatDataOwnerInfo.Ptr()), aFlatDataOwnerInfo.Size());
   138 		TPtr8 pSource(const_cast<TUint8*>(aFlatDataOwnerInfo.Ptr()), aFlatDataOwnerInfo.Size());
   122 		pSource.SetMax();
   139 		pSource.SetMax();
   123 		
   140 		
   124 		// Position that we've read up to in the externalised class buffer
   141 		// Position that we've read up to in the externalised class buffer
   135 
   152 
   136 		UnpackTypeAdvance(iCommonBURSettings, pSource, sourcePos);
   153 		UnpackTypeAdvance(iCommonBURSettings, pSource, sourcePos);
   137 		UnpackTypeAdvance(iPassiveBURSettings, pSource, sourcePos);
   154 		UnpackTypeAdvance(iPassiveBURSettings, pSource, sourcePos);
   138 		UnpackTypeAdvance(iActiveBURSettings, pSource, sourcePos);
   155 		UnpackTypeAdvance(iActiveBURSettings, pSource, sourcePos);
   139 		UnpackTypeAdvance(iDriveList, pSource, sourcePos);
   156 		UnpackTypeAdvance(iDriveList, pSource, sourcePos);
       
   157 		OstTraceFunctionExit0( DUP1_CDATAOWNERINFO_CONSTRUCTL_EXIT );
   140 		}
   158 		}
   141 		
   159 		
   142 	EXPORT_C CSBGenericDataType& CDataOwnerInfo::Identifier()
   160 	EXPORT_C CSBGenericDataType& CDataOwnerInfo::Identifier()
   143 	/**
   161 	/**
   144 	Getter method for returning a reference to the CSBGenericDataType
   162 	Getter method for returning a reference to the CSBGenericDataType
   224 	returned
   242 	returned
   225 	
   243 	
   226 	@return The externalised buffer
   244 	@return The externalised buffer
   227 	*/
   245 	*/
   228 		{
   246 		{
       
   247 		OstTraceFunctionEntry0( CDATAOWNERINFO_EXTERNALISEL_ENTRY );
   229 		HBufC8* dataOwnerBuffer = ExternaliseLC();
   248 		HBufC8* dataOwnerBuffer = ExternaliseLC();
   230 		CleanupStack::Pop(dataOwnerBuffer);
   249 		CleanupStack::Pop(dataOwnerBuffer);
   231 		
   250 		
       
   251 		OstTraceFunctionExit0( CDATAOWNERINFO_EXTERNALISEL_EXIT );
   232 		return dataOwnerBuffer;
   252 		return dataOwnerBuffer;
   233 		}
   253 		}
   234 		
   254 		
   235 	EXPORT_C HBufC8* CDataOwnerInfo::ExternaliseLC()
   255 	EXPORT_C HBufC8* CDataOwnerInfo::ExternaliseLC()
   236 	/**
   256 	/**
   238 	or appended to a PC bound message, leaves the pointer on the cleanup stack.
   258 	or appended to a PC bound message, leaves the pointer on the cleanup stack.
   239 	
   259 	
   240 	@return The externalised buffer
   260 	@return The externalised buffer
   241 	*/
   261 	*/
   242 		{
   262 		{
       
   263 		OstTraceFunctionEntry0( CDATAOWNERINFO_EXTERNALISELC_ENTRY );
   243 		HBufC8* dataBuffer = HBufC8::NewLC(Size());				
   264 		HBufC8* dataBuffer = HBufC8::NewLC(Size());				
   244 		TPtr8 bufferPtr(dataBuffer->Des());
   265 		TPtr8 bufferPtr(dataBuffer->Des());
   245 						
   266 						
   246 		iDriveList.SetMax();	// Ensure that the drivelist array is set to max
   267 		iDriveList.SetMax();	// Ensure that the drivelist array is set to max
   247 		const TDesC8& dataType = iGenericDataType->Externalise();
   268 		const TDesC8& dataType = iGenericDataType->Externalise();
   252 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iCommonBURSettings), sizeof(TCommonBURSettings));
   273 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iCommonBURSettings), sizeof(TCommonBURSettings));
   253 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iPassiveBURSettings), sizeof(TPassiveBURSettings));
   274 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iPassiveBURSettings), sizeof(TPassiveBURSettings));
   254 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iActiveBURSettings), sizeof(TActiveBURSettings));
   275 		bufferPtr.Append(reinterpret_cast<TUint8*>(&iActiveBURSettings), sizeof(TActiveBURSettings));
   255 		bufferPtr.Append(iDriveList);
   276 		bufferPtr.Append(iDriveList);
   256 		
   277 		
       
   278 		OstTraceFunctionExit0( CDATAOWNERINFO_EXTERNALISELC_EXIT );
   257 		return dataBuffer;
   279 		return dataBuffer;
   258 		}
   280 		}
   259 		
   281 		
   260 	EXPORT_C TInt CDataOwnerInfo::Size() const
   282 	EXPORT_C TInt CDataOwnerInfo::Size() const
   261 	/**
   283 	/**
   263 	size of a descriptor to fit the externalised instance of this object
   285 	size of a descriptor to fit the externalised instance of this object
   264 	
   286 	
   265 	@return Size of class in bytes once flattened
   287 	@return Size of class in bytes once flattened
   266 	*/
   288 	*/
   267 		{
   289 		{
       
   290 		OstTraceFunctionEntry0( CDATAOWNERINFO_SIZE_ENTRY );
   268 		TInt size = 	sizeof(TCommonBURSettings) +
   291 		TInt size = 	sizeof(TCommonBURSettings) +
   269 						sizeof(TPassiveBURSettings) +
   292 						sizeof(TPassiveBURSettings) +
   270 						sizeof(TActiveBURSettings) +
   293 						sizeof(TActiveBURSettings) +
   271 						sizeof(TInt32) + 	// Buffer size is stored as a TInt32
   294 						sizeof(TInt32) + 	// Buffer size is stored as a TInt32
   272 						iGenericDataType->Externalise().Size() +
   295 						iGenericDataType->Externalise().Size() +
   273 						iDriveList.Size();
   296 						iDriveList.Size();
   274 						
   297 						
       
   298 		OstTraceFunctionExit0( CDATAOWNERINFO_SIZE_EXIT );
   275 		return size;
   299 		return size;
   276 		}
   300 		}
   277 		
   301 		
   278 	// CSBGenericDataType			
   302 	// CSBGenericDataType			
   279 	EXPORT_C CSBGenericDataType* CSBGenericDataType::NewL(const TDesC8& aDes)
   303 	EXPORT_C CSBGenericDataType* CSBGenericDataType::NewL(const TDesC8& aDes)
   285 
   309 
   286 	@param aDes descriptor containing the buffer of data
   310 	@param aDes descriptor containing the buffer of data
   287 	@return A pointer to the CSBGenericDataType object
   311 	@return A pointer to the CSBGenericDataType object
   288 	*/
   312 	*/
   289 		{
   313 		{
       
   314 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_NEWL_ENTRY );
   290 		CSBGenericDataType* self = new(ELeave) CSBGenericDataType();
   315 		CSBGenericDataType* self = new(ELeave) CSBGenericDataType();
   291 		CleanupStack::PushL(self);
   316 		CleanupStack::PushL(self);
   292 		self->ConstructL(aDes);
   317 		self->ConstructL(aDes);
   293 		CleanupStack::Pop(self);
   318 		CleanupStack::Pop(self);
       
   319 		OstTraceFunctionExit0( CSBGENERICDATATYPE_NEWL_EXIT );
   294 		return self;
   320 		return self;
   295 		}
   321 		}
   296 	
   322 	
   297 	CSBGenericDataType::CSBGenericDataType(): iDataBuffer(NULL)
   323 	CSBGenericDataType::CSBGenericDataType(): iDataBuffer(NULL)
   298 	/**
   324 	/**
   299 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   325 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   300 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   326 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   301 	to be large enough to accomodate the data stored by the derived type
   327 	to be large enough to accomodate the data stored by the derived type
   302 	*/
   328 	*/
   303 		{
   329 		{
       
   330 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_CSBGENERICDATATYPE_CONS_ENTRY );
   304 		// Initialise iSize
   331 		// Initialise iSize
   305 		iSize = sizeof(TSBDerivedType);
   332 		iSize = sizeof(TSBDerivedType);
       
   333 		OstTraceFunctionExit0( CSBGENERICDATATYPE_CSBGENERICDATATYPE_CONS_EXIT );
   306 		}
   334 		}
   307 
   335 
   308 	EXPORT_C CSBGenericDataType::~CSBGenericDataType()
   336 	EXPORT_C CSBGenericDataType::~CSBGenericDataType()
   309 	/**
   337 	/**
   310 	C++ Destructor
   338 	C++ Destructor
   311 	*/
   339 	*/
   312 		{
   340 		{
       
   341 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_CSBGENERICDATATYPE_DES_ENTRY );
   313 		delete iDataBuffer;
   342 		delete iDataBuffer;
       
   343 		iDataBuffer = NULL;
       
   344 		OstTraceFunctionExit0( CSBGENERICDATATYPE_CSBGENERICDATATYPE_DES_EXIT );
   314 		}
   345 		}
   315 
   346 
   316 	void CSBGenericDataType::ConstructL(const TDesC8& aDes)
   347 	void CSBGenericDataType::ConstructL(const TDesC8& aDes)
   317 	/**
   348 	/**
   318 	Symbian OS 2nd phase constructor. Called when creating a base class from raw data
   349 	Symbian OS 2nd phase constructor. Called when creating a base class from raw data
   319 	i.e. off the wire/IPC. Creates the base type data buffer to store object data in
   350 	i.e. off the wire/IPC. Creates the base type data buffer to store object data in
   320 
   351 
   321 	@param aDes descriptor containing the buffer of data
   352 	@param aDes descriptor containing the buffer of data
   322 	*/
   353 	*/
   323 		{
   354 		{
       
   355 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_CONSTRUCTL_ENTRY );
   324 		// Store the length of the descriptor as our max length
   356 		// Store the length of the descriptor as our max length
   325 		iSize = aDes.Size();
   357 		iSize = aDes.Size();
   326 			
   358 			
   327 		// Create a new buffer and copy the passed one into it
   359 		// Create a new buffer and copy the passed one into it
   328 		iDataBuffer = HBufC8::NewL(iSize);
   360 		iDataBuffer = HBufC8::NewL(iSize);
   333 		// Initialise member pointers of all classes in the inheritence tree
   365 		// Initialise member pointers of all classes in the inheritence tree
   334 		InitialiseL(offset);
   366 		InitialiseL(offset);
   335 		
   367 		
   336 		// The base type should be as long as the des passed in (more info in a derived)
   368 		// The base type should be as long as the des passed in (more info in a derived)
   337 		iDataBuffer->Des().SetLength(iSize);
   369 		iDataBuffer->Des().SetLength(iSize);
       
   370 		OstTraceFunctionExit0( CSBGENERICDATATYPE_CONSTRUCTL_EXIT );
   338 		}
   371 		}
   339 		
   372 		
   340 	void CSBGenericDataType::InitialiseL(TInt& aOffset)
   373 	void CSBGenericDataType::InitialiseL(TInt& aOffset)
   341 	/**
   374 	/**
   342 	Initialise all of member data offsets inside the base and derived classes
   375 	Initialise all of member data offsets inside the base and derived classes
   343 	
   376 	
   344 	@param 	aOffset The running offset indicating the position in the descriptor that has 
   377 	@param 	aOffset The running offset indicating the position in the descriptor that has 
   345 			been parsed up to
   378 			been parsed up to
   346 	*/
   379 	*/
   347 		{
   380 		{
       
   381 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_INITIALISEL_ENTRY );
   348 		if (iSize < sizeof(TSBDerivedType))
   382 		if (iSize < sizeof(TSBDerivedType))
   349 			{
   383 			{
       
   384 		    OstTrace0(TRACE_ERROR, CSBGENERICDATATYPE_INITIALISEL, "Leave: KErrCorrupt");
   350 			User::Leave(KErrCorrupt);
   385 			User::Leave(KErrCorrupt);
   351 			}
   386 			}
   352 		
   387 		
   353 		// Throwaway type used to determine the offset advance
   388 		// Throwaway type used to determine the offset advance
   354 		TSBDerivedType derivedType;
   389 		TSBDerivedType derivedType;
   356 		iDerivedTypeOffset = aOffset;
   391 		iDerivedTypeOffset = aOffset;
   357 		UnpackTypeAdvance(derivedType, *iDataBuffer, aOffset);
   392 		UnpackTypeAdvance(derivedType, *iDataBuffer, aOffset);
   358 		
   393 		
   359 		if (derivedType < 0 || derivedType > KMaxDerivedTypes)
   394 		if (derivedType < 0 || derivedType > KMaxDerivedTypes)
   360 			{
   395 			{
       
   396 		    OstTrace0(TRACE_ERROR, DUP1_CSBGENERICDATATYPE_INITIALISEL, "Leave: KErrCorrupt");
   361 			User::Leave(KErrCorrupt);
   397 			User::Leave(KErrCorrupt);
   362 			}
   398 			}
   363 				
   399 				
   364 		iDataBuffer->Des().SetLength(aOffset);
   400 		iDataBuffer->Des().SetLength(aOffset);
   365 		
   401 		
       
   402 		OstTraceFunctionExit0( CSBGENERICDATATYPE_INITIALISEL_EXIT );
   366 		}
   403 		}
   367 	
   404 	
   368 	void CSBGenericDataType::BaseConstructL()
   405 	void CSBGenericDataType::BaseConstructL()
   369 	/**
   406 	/**
   370 	Symbian OS 2nd phase constructor. Called by derived classes when creating an end 
   407 	Symbian OS 2nd phase constructor. Called by derived classes when creating an end 
   372 	data in. Size of buffer has been determined by C++ constructors of all classes 
   409 	data in. Size of buffer has been determined by C++ constructors of all classes 
   373 	in inheritence tree incrementing iSize member so that a buffer big enough to store
   410 	in inheritence tree incrementing iSize member so that a buffer big enough to store
   374 	the data of all classes is created.
   411 	the data of all classes is created.
   375 	*/
   412 	*/
   376 		{
   413 		{
       
   414 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_BASECONSTRUCTL_ENTRY );
   377 		// All derived classes should += their size to iSize
   415 		// All derived classes should += their size to iSize
   378 		iDataBuffer = HBufC8::NewL(iSize);
   416 		iDataBuffer = HBufC8::NewL(iSize);
       
   417 		OstTraceFunctionExit0( CSBGENERICDATATYPE_BASECONSTRUCTL_EXIT );
   379 		}
   418 		}
   380 		
   419 		
   381 	EXPORT_C const TDesC8& CSBGenericDataType::Externalise() const
   420 	EXPORT_C const TDesC8& CSBGenericDataType::Externalise() const
   382 	/**
   421 	/**
   383 	Getter for a reference to the buffer containing the data
   422 	Getter for a reference to the buffer containing the data
   394 	which derived type this base type contains
   433 	which derived type this base type contains
   395 	
   434 	
   396 	@return The type of the derived object
   435 	@return The type of the derived object
   397 	*/
   436 	*/
   398 		{
   437 		{
       
   438 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_DERIVEDTYPEL_ENTRY );
   399 		TSBDerivedType derivedType;
   439 		TSBDerivedType derivedType;
   400 		
   440 		
   401 		UnpackType(derivedType, *iDataBuffer, iDerivedTypeOffset);
   441 		UnpackType(derivedType, *iDataBuffer, iDerivedTypeOffset);
   402 		
   442 		
       
   443 		OstTraceFunctionExit0( CSBGENERICDATATYPE_DERIVEDTYPEL_EXIT );
   403 		return derivedType;
   444 		return derivedType;
   404 		}
   445 		}
   405 
   446 
   406 	void CSBGenericDataType::UnpackDescriptorTypeAdvance(TDesC16& aDes, TInt& aOffset)
   447 	void CSBGenericDataType::UnpackDescriptorTypeAdvance(TDesC16& aDes, TInt& aOffset)
   407 		/**
   448 		/**
   412 		
   453 		
   413 		@param aDes The buffer that contains the type T pointed to by aPtr
   454 		@param aDes The buffer that contains the type T pointed to by aPtr
   414 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   455 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   415 		*/
   456 		*/
   416 		{
   457 		{
       
   458 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_UNPACKDESCRIPTORTYPEADVANCE_ENTRY );
   417 		// Set length of the unicode string in characters
   459 		// Set length of the unicode string in characters
   418 		TUint32 length;
   460 		TUint32 length;
   419 	
   461 	
   420 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   462 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   421 		
   463 		
   425 		for (TInt32 index = 0; index < (length * KCharWidthInBytes) ; index++)
   467 		for (TInt32 index = 0; index < (length * KCharWidthInBytes) ; index++)
   426 			{
   468 			{
   427 			*pRawTarget++ = *pRawSource++;
   469 			*pRawTarget++ = *pRawSource++;
   428 			aOffset++;
   470 			aOffset++;
   429 			}
   471 			}
       
   472 		OstTraceFunctionExit0( CSBGENERICDATATYPE_UNPACKDESCRIPTORTYPEADVANCE_EXIT );
   430 		}
   473 		}
   431 
   474 
   432 	void CSBGenericDataType::UnpackDescriptorTypeAdvance(TDesC8& aDes, TInt& aOffset)
   475 	void CSBGenericDataType::UnpackDescriptorTypeAdvance(TDesC8& aDes, TInt& aOffset)
   433 		/**
   476 		/**
   434 		Function to copy a simple type from a specified position in aDes
   477 		Function to copy a simple type from a specified position in aDes
   438 		
   481 		
   439 		@param aDes The buffer that contains the descriptor to copy from
   482 		@param aDes The buffer that contains the descriptor to copy from
   440 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   483 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   441 		*/
   484 		*/
   442 		{
   485 		{
       
   486 		OstTraceFunctionEntry0( DUP1_CSBGENERICDATATYPE_UNPACKDESCRIPTORTYPEADVANCE_ENTRY );
   443 		// Set length of the string in 8-bit byte characters
   487 		// Set length of the string in 8-bit byte characters
   444 		TUint32 length;
   488 		TUint32 length;
   445 	
   489 	
   446 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   490 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   447 		
   491 		
   451 		for (TInt32 index = 0; index < length ; index++)
   495 		for (TInt32 index = 0; index < length ; index++)
   452 			{
   496 			{
   453 			*pRawTarget++ = *pRawSource++;
   497 			*pRawTarget++ = *pRawSource++;
   454 			aOffset++;
   498 			aOffset++;
   455 			}
   499 			}
       
   500 		OstTraceFunctionExit0( DUP1_CSBGENERICDATATYPE_UNPACKDESCRIPTORTYPEADVANCE_EXIT );
   456 		}
   501 		}
   457 
   502 
   458 	void CSBGenericDataType::UnpackTPtrAdvance(TPtrC16& aDes, TInt& aOffset)
   503 	void CSBGenericDataType::UnpackTPtrAdvance(TPtrC16& aDes, TInt& aOffset)
   459 		/**
   504 		/**
   460 		Function to copy a simple type from a specified position in aDes
   505 		Function to copy a simple type from a specified position in aDes
   464 		
   509 		
   465 		@param aDes The buffer that contains the type T pointed to by aPtr
   510 		@param aDes The buffer that contains the type T pointed to by aPtr
   466 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   511 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   467 		*/
   512 		*/
   468 		{
   513 		{
       
   514 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_UNPACKTPTRADVANCE_ENTRY );
   469 		// Set length of the unicode string in characters
   515 		// Set length of the unicode string in characters
   470 		TInt32 length;
   516 		TInt32 length;
   471 	
   517 	
   472 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   518 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   473 		
   519 		
   474 		aDes.Set(reinterpret_cast<const TUint16*>(iDataBuffer->Ptr() + aOffset), length);
   520 		aDes.Set(reinterpret_cast<const TUint16*>(iDataBuffer->Ptr() + aOffset), length);
   475 
   521 
   476 		aOffset += aDes.Size();
   522 		aOffset += aDes.Size();
       
   523 		OstTraceFunctionExit0( CSBGENERICDATATYPE_UNPACKTPTRADVANCE_EXIT );
   477 		}
   524 		}
   478 
   525 
   479 	void CSBGenericDataType::UnpackTPtrAdvance(TPtrC8& aDes, TInt& aOffset)
   526 	void CSBGenericDataType::UnpackTPtrAdvance(TPtrC8& aDes, TInt& aOffset)
   480 		/**
   527 		/**
   481 		Function to copy a simple type from a specified position in aDes
   528 		Function to copy a simple type from a specified position in aDes
   485 		
   532 		
   486 		@param aDes The buffer that contains the descriptor to copy from
   533 		@param aDes The buffer that contains the descriptor to copy from
   487 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   534 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   488 		*/
   535 		*/
   489 		{
   536 		{
       
   537 		OstTraceFunctionEntry0( DUP1_CSBGENERICDATATYPE_UNPACKTPTRADVANCE_ENTRY );
   490 		// Set length of the string in 8-bit byte characters
   538 		// Set length of the string in 8-bit byte characters
   491 		TInt32 length;
   539 		TInt32 length;
   492 	
   540 	
   493 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   541 		UnpackTypeAdvance(length, *iDataBuffer, aOffset);
   494 		
   542 		
   495 		aDes.Set(iDataBuffer->Ptr() + aOffset, length);
   543 		aDes.Set(iDataBuffer->Ptr() + aOffset, length);
   496 
   544 
   497 		aOffset += aDes.Size();
   545 		aOffset += aDes.Size();
       
   546 		OstTraceFunctionExit0( DUP1_CSBGENERICDATATYPE_UNPACKTPTRADVANCE_EXIT );
   498 		}
   547 		}
   499 
   548 
   500 	void CSBGenericDataType::PackDescriptorTypeAdvance(const TDesC16& aDes, TInt& aOffset)
   549 	void CSBGenericDataType::PackDescriptorTypeAdvance(const TDesC16& aDes, TInt& aOffset)
   501 		/**
   550 		/**
   502 		Templated function to copy a simple type into a specified position in aDes
   551 		Templated function to copy a simple type into a specified position in aDes
   504 		
   553 		
   505 		@param aDes The buffer to copy from
   554 		@param aDes The buffer to copy from
   506 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   555 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   507 		*/
   556 		*/
   508 		{
   557 		{
       
   558 		OstTraceFunctionEntry0( CSBGENERICDATATYPE_PACKDESCRIPTORTYPEADVANCE_ENTRY );
   509 		TInt32 length = aDes.Length();
   559 		TInt32 length = aDes.Length();
   510 
   560 
   511 		PackTypeAdvance(length, *iDataBuffer, aOffset);
   561 		PackTypeAdvance(length, *iDataBuffer, aOffset);
   512 
   562 
   513  		TUint8* pRawSource = const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aDes.Ptr()));
   563  		TUint8* pRawSource = const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aDes.Ptr()));
   516 		for (TInt32 index = 0; index < (length * KCharWidthInBytes); index++)
   566 		for (TInt32 index = 0; index < (length * KCharWidthInBytes); index++)
   517 			{
   567 			{
   518 			*pRawTarget++ = *pRawSource++;
   568 			*pRawTarget++ = *pRawSource++;
   519 			aOffset++;
   569 			aOffset++;
   520 			}
   570 			}
       
   571 		OstTraceFunctionExit0( CSBGENERICDATATYPE_PACKDESCRIPTORTYPEADVANCE_EXIT );
   521 		}
   572 		}
   522 
   573 
   523 	void CSBGenericDataType::PackDescriptorTypeAdvance(const TDesC8& aDes, TInt& aOffset)
   574 	void CSBGenericDataType::PackDescriptorTypeAdvance(const TDesC8& aDes, TInt& aOffset)
   524 		/**
   575 		/**
   525 		Templated function to copy a simple type into a specified position in aDes
   576 		Templated function to copy a simple type into a specified position in aDes
   527 		
   578 		
   528 		@param aDes The buffer to copy from
   579 		@param aDes The buffer to copy from
   529 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   580 		@param aOffset The running index of where the following type begins. Updated by ExtractPointer
   530 		*/
   581 		*/
   531 		{
   582 		{
       
   583 		OstTraceFunctionEntry0( DUP1_CSBGENERICDATATYPE_PACKDESCRIPTORTYPEADVANCE_ENTRY );
   532 		TInt32 length = aDes.Size();
   584 		TInt32 length = aDes.Size();
   533 
   585 
   534 		PackTypeAdvance(length, *iDataBuffer, aOffset);
   586 		PackTypeAdvance(length, *iDataBuffer, aOffset);
   535 
   587 
   536 		TUint8* pRawSource = const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aDes.Ptr()));
   588 		TUint8* pRawSource = const_cast<TUint8*>(reinterpret_cast<const TUint8*>(aDes.Ptr()));
   539 		for (TInt32 index = 0; index < length; index++)
   591 		for (TInt32 index = 0; index < length; index++)
   540 			{
   592 			{
   541 			*pRawTarget++ = *pRawSource++;
   593 			*pRawTarget++ = *pRawSource++;
   542 			aOffset++;
   594 			aOffset++;
   543 			}
   595 			}
       
   596 		OstTraceFunctionExit0( DUP1_CSBGENERICDATATYPE_PACKDESCRIPTORTYPEADVANCE_EXIT );
   544 		}
   597 		}
   545 		
   598 		
   546 		
   599 		
   547 // CSBSecureId
   600 // CSBSecureId
   548 	EXPORT_C CSBSecureId* CSBSecureId::NewL(TSecureId aSecureId)
   601 	EXPORT_C CSBSecureId* CSBSecureId::NewL(TSecureId aSecureId)
   552 
   605 
   553 	@param aSecureId the secure identifier
   606 	@param aSecureId the secure identifier
   554 	@return A pointer to the CSBSecureId object
   607 	@return A pointer to the CSBSecureId object
   555 	*/
   608 	*/
   556 		{
   609 		{
       
   610 		OstTraceFunctionEntry0( CSBSECUREID_NEWL_ENTRY );
   557 		CSBSecureId* self = new(ELeave) CSBSecureId();
   611 		CSBSecureId* self = new(ELeave) CSBSecureId();
   558 		CleanupStack::PushL(self);
   612 		CleanupStack::PushL(self);
   559 		self->ConstructL(aSecureId);
   613 		self->ConstructL(aSecureId);
   560 		CleanupStack::Pop(self);
   614 		CleanupStack::Pop(self);
       
   615 		OstTraceFunctionExit0( CSBSECUREID_NEWL_EXIT );
   561 		return self;
   616 		return self;
   562 		}
   617 		}
   563 	
   618 	
   564 	EXPORT_C CSBSecureId* CSBSecureId::NewL(CSBGenericDataType* aGenericDataType)
   619 	EXPORT_C CSBSecureId* CSBSecureId::NewL(CSBGenericDataType* aGenericDataType)
   565 	/**
   620 	/**
   569 
   624 
   570 	@param aGenericDataType pointer to a CSBGenericDataType object
   625 	@param aGenericDataType pointer to a CSBGenericDataType object
   571 	@return A pointer to the CSBSecureId object
   626 	@return A pointer to the CSBSecureId object
   572 	*/
   627 	*/
   573 		{
   628 		{
       
   629 		OstTraceFunctionEntry0( DUP1_CSBSECUREID_NEWL_ENTRY );
   574 		CSBSecureId* self = new(ELeave) CSBSecureId();
   630 		CSBSecureId* self = new(ELeave) CSBSecureId();
   575 		CleanupStack::PushL(self);
   631 		CleanupStack::PushL(self);
   576 		self->ConstructL(aGenericDataType);
   632 		self->ConstructL(aGenericDataType);
   577 		CleanupStack::Pop(self);
   633 		CleanupStack::Pop(self);
       
   634 		OstTraceFunctionExit0( DUP1_CSBSECUREID_NEWL_EXIT );
   578 		return self;
   635 		return self;
   579 		}
   636 		}
   580 		
   637 		
   581 	CSBSecureId::CSBSecureId()
   638 	CSBSecureId::CSBSecureId()
   582 	/**
   639 	/**
   583 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   640 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   584 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   641 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   585 	to be large enough to accomodate the data stored by the derived type
   642 	to be large enough to accomodate the data stored by the derived type
   586 	*/
   643 	*/
   587 		{
   644 		{
       
   645 		OstTraceFunctionEntry0( CSBSECUREID_CSBSECUREID_CONS_ENTRY );
   588 		iSize += sizeof(TSecureId);
   646 		iSize += sizeof(TSecureId);
       
   647 		OstTraceFunctionExit0( CSBSECUREID_CSBSECUREID_CONS_EXIT );
   589 		}
   648 		}
   590 
   649 
   591 	EXPORT_C CSBSecureId::~CSBSecureId()
   650 	EXPORT_C CSBSecureId::~CSBSecureId()
   592 	/**
   651 	/**
   593 	C++ Destructor
   652 	C++ Destructor
   594 	*/
   653 	*/
   595 		{
   654 		{
       
   655 		OstTraceFunctionEntry0( CSBSECUREID_CSBSECUREID_DES_ENTRY );
       
   656 		OstTraceFunctionExit0( CSBSECUREID_CSBSECUREID_DES_EXIT );
   596 		}
   657 		}
   597 
   658 
   598 	void CSBSecureId::InitialiseL(TInt& aOffset)
   659 	void CSBSecureId::InitialiseL(TInt& aOffset)
   599 	/**
   660 	/**
   600 	Initialise all member pointers to data
   661 	Initialise all member pointers to data
   601 	
   662 	
   602 	@param aOffset The running offset of where the descriptor has been parsed up to
   663 	@param aOffset The running offset of where the descriptor has been parsed up to
   603 	*/
   664 	*/
   604 		{
   665 		{
       
   666 		OstTraceFunctionEntry0( CSBSECUREID_INITIALISEL_ENTRY );
   605 		// Throwaway type used for sizeof information only
   667 		// Throwaway type used for sizeof information only
   606 		TSecureId sid;
   668 		TSecureId sid;
   607 		
   669 		
   608 		CSBGenericDataType::InitialiseL(aOffset);
   670 		CSBGenericDataType::InitialiseL(aOffset);
   609 		iSecureIdOffset = aOffset;
   671 		iSecureIdOffset = aOffset;
   610 
   672 
   611 		UnpackTypeAdvance(sid, *iDataBuffer, aOffset);
   673 		UnpackTypeAdvance(sid, *iDataBuffer, aOffset);
   612 		
   674 		
   613 		// Increment the size of the data buffer
   675 		// Increment the size of the data buffer
   614 		iDataBuffer->Des().SetLength(aOffset);
   676 		iDataBuffer->Des().SetLength(aOffset);
       
   677 		OstTraceFunctionExit0( CSBSECUREID_INITIALISEL_EXIT );
   615 		}
   678 		}
   616 
   679 
   617 	void CSBSecureId::ConstructL(TSecureId aSecureId)
   680 	void CSBSecureId::ConstructL(TSecureId aSecureId)
   618 	/**
   681 	/**
   619 	Symbian OS 2nd phase constructor.
   682 	Symbian OS 2nd phase constructor.
   620 
   683 
   621 	@param aSecureId the secure identifier
   684 	@param aSecureId the secure identifier
   622 	*/
   685 	*/
   623 		{
   686 		{
       
   687 		OstTraceFunctionEntry0( CSBSECUREID_CONSTRUCTL_ENTRY );
   624 		TInt offset = 0;
   688 		TInt offset = 0;
   625 		// Call the Base ConstructL in order to allocate the buffer
   689 		// Call the Base ConstructL in order to allocate the buffer
   626 		BaseConstructL();
   690 		BaseConstructL();
   627 		
   691 		
   628 		TSBDerivedType derivedType = ESIDDerivedType;
   692 		TSBDerivedType derivedType = ESIDDerivedType;
   631 		InitialiseL(offset);
   695 		InitialiseL(offset);
   632 		
   696 		
   633 		TSecureId sid = aSecureId;
   697 		TSecureId sid = aSecureId;
   634 		
   698 		
   635 		PackType(sid, *iDataBuffer, iSecureIdOffset);
   699 		PackType(sid, *iDataBuffer, iSecureIdOffset);
       
   700 		OstTraceFunctionExit0( CSBSECUREID_CONSTRUCTL_EXIT );
   636 		}
   701 		}
   637 		
   702 		
   638 	void CSBSecureId::ConstructL(CSBGenericDataType* aGenericDataType)
   703 	void CSBSecureId::ConstructL(CSBGenericDataType* aGenericDataType)
   639 	/**
   704 	/**
   640 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
   705 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
   641 
   706 
   642 	@param aGenericDataType pointer to a CSBGenericDataType object
   707 	@param aGenericDataType pointer to a CSBGenericDataType object
   643 	*/
   708 	*/
   644 		{
   709 		{
       
   710 		OstTraceFunctionEntry0( DUP1_CSBSECUREID_CONSTRUCTL_ENTRY );
   645 		if (aGenericDataType == NULL)
   711 		if (aGenericDataType == NULL)
   646 			{
   712 			{
       
   713 		    OstTrace0(TRACE_ERROR, CSBSECUREID_CONSTRUCTL, "Leave: KErrArgument");
   647 			User::Leave(KErrArgument);
   714 			User::Leave(KErrArgument);
   648 			}
   715 			}
   649 		if (ESIDDerivedType != aGenericDataType->DerivedTypeL())
   716 		if (ESIDDerivedType != aGenericDataType->DerivedTypeL())
   650 			{
   717 			{
       
   718 		    OstTrace0(TRACE_ERROR, DUP1_CSBSECUREID_CONSTRUCTL, "Leave: KErrArgument");
   651 			User::Leave(KErrArgument);
   719 			User::Leave(KErrArgument);
   652 			}
   720 			}
   653 		// If the descriptor is different to the size we're expecting then it's not correct
   721 		// If the descriptor is different to the size we're expecting then it's not correct
   654 		const TDesC8& des = aGenericDataType->Externalise();
   722 		const TDesC8& des = aGenericDataType->Externalise();
   655 		if (des.Size() != iSize)
   723 		if (des.Size() != iSize)
   656 			{
   724 			{
       
   725 		    OstTrace0(TRACE_ERROR, DUP2_CSBSECUREID_CONSTRUCTL, "Leave: KErrArgument");
   657 			User::Leave(KErrArgument);
   726 			User::Leave(KErrArgument);
   658 			}
   727 			}
   659 		
   728 		
   660 		// Call the base class ConstructL
   729 		// Call the base class ConstructL
   661 		CSBGenericDataType::ConstructL(des);
   730 		CSBGenericDataType::ConstructL(des);
       
   731 		OstTraceFunctionExit0( DUP1_CSBSECUREID_CONSTRUCTL_EXIT );
   662 		}
   732 		}
   663 		
   733 		
   664 	EXPORT_C TSecureId CSBSecureId::SecureIdL() const
   734 	EXPORT_C TSecureId CSBSecureId::SecureIdL() const
   665 	/**
   735 	/**
   666 	Getter for the secure identifier
   736 	Getter for the secure identifier
   667 		
   737 		
   668 	@return  The secure identifier
   738 	@return  The secure identifier
   669 	*/
   739 	*/
   670 		{
   740 		{
       
   741 		OstTraceFunctionEntry0( CSBSECUREID_SECUREIDL_ENTRY );
   671 		TSecureId sid;
   742 		TSecureId sid;
   672 		
   743 		
   673 		UnpackType(sid, *iDataBuffer, iSecureIdOffset);
   744 		UnpackType(sid, *iDataBuffer, iSecureIdOffset);
   674 		
   745 		
       
   746 		OstTraceFunctionExit0( CSBSECUREID_SECUREIDL_EXIT );
   675 		return sid;
   747 		return sid;
   676 		}
   748 		}
   677 	
   749 	
   678 	
   750 	
   679 	// CSBPackageId
   751 	// CSBPackageId
   686 	@param aSecureId  the secure identifier
   758 	@param aSecureId  the secure identifier
   687 	@param aPackageName  the name of the package
   759 	@param aPackageName  the name of the package
   688 	@return A pointer to the CSBPackageId object
   760 	@return A pointer to the CSBPackageId object
   689 	*/
   761 	*/
   690 		{
   762 		{
       
   763 		OstTraceFunctionEntry0( CSBPACKAGEID_NEWL_ENTRY );
   691 		CSBPackageId* self = new(ELeave) CSBPackageId();
   764 		CSBPackageId* self = new(ELeave) CSBPackageId();
   692 		CleanupStack::PushL(self);
   765 		CleanupStack::PushL(self);
   693 		self->ConstructL(aPackageId, aSecureId, aPackageName);
   766 		self->ConstructL(aPackageId, aSecureId, aPackageName);
   694 		CleanupStack::Pop(self);
   767 		CleanupStack::Pop(self);
       
   768 		OstTraceFunctionExit0( CSBPACKAGEID_NEWL_EXIT );
   695 		return self;
   769 		return self;
   696 		}
   770 		}
   697 	
   771 	
   698 	EXPORT_C CSBPackageId* CSBPackageId::NewL(CSBGenericDataType* aGenericDataType)
   772 	EXPORT_C CSBPackageId* CSBPackageId::NewL(CSBGenericDataType* aGenericDataType)
   699 	/**
   773 	/**
   703 
   777 
   704 	@param aGenericDataType  pointer to a CSBGenericDataType object
   778 	@param aGenericDataType  pointer to a CSBGenericDataType object
   705 	@return A pointer to the CSBPackageId object
   779 	@return A pointer to the CSBPackageId object
   706 	*/
   780 	*/
   707 		{
   781 		{
       
   782 		OstTraceFunctionEntry0( DUP1_CSBPACKAGEID_NEWL_ENTRY );
   708 		CSBPackageId* self = new(ELeave) CSBPackageId();
   783 		CSBPackageId* self = new(ELeave) CSBPackageId();
   709 		CleanupStack::PushL(self);
   784 		CleanupStack::PushL(self);
   710 		self->ConstructL(aGenericDataType);
   785 		self->ConstructL(aGenericDataType);
   711 		CleanupStack::Pop(self);
   786 		CleanupStack::Pop(self);
       
   787 		OstTraceFunctionExit0( DUP1_CSBPACKAGEID_NEWL_EXIT );
   712 		return self;
   788 		return self;
   713 		}	
   789 		}	
   714 	
   790 	
   715 	CSBPackageId::CSBPackageId()
   791 	CSBPackageId::CSBPackageId()
   716 	/**
   792 	/**
   717 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   793 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   718 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   794 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   719 	to be large enough to accomodate the data stored by the derived type
   795 	to be large enough to accomodate the data stored by the derived type
   720 	*/
   796 	*/
   721 		{
   797 		{
       
   798 		OstTraceFunctionEntry0( CSBPACKAGEID_CSBPACKAGEID_CONS_ENTRY );
   722 		iSize += (sizeof(TUid) + sizeof(TSecureId) + sizeof(TPackageName));
   799 		iSize += (sizeof(TUid) + sizeof(TSecureId) + sizeof(TPackageName));
       
   800 		OstTraceFunctionExit0( CSBPACKAGEID_CSBPACKAGEID_CONS_EXIT );
   723 		}
   801 		}
   724 
   802 
   725 	EXPORT_C CSBPackageId::~CSBPackageId()
   803 	EXPORT_C CSBPackageId::~CSBPackageId()
   726 	/**
   804 	/**
   727 	C++ Destructor
   805 	C++ Destructor
   728 	*/
   806 	*/
   729 		{
   807 		{
       
   808 		OstTraceFunctionEntry0( CSBPACKAGEID_CSBPACKAGEID_DES_ENTRY );
       
   809 		OstTraceFunctionExit0( CSBPACKAGEID_CSBPACKAGEID_DES_EXIT );
   730 		}
   810 		}
   731 
   811 
   732 
   812 
   733 	void CSBPackageId::InitialiseL(TInt& aOffset, TInt aPackageNameLength)
   813 	void CSBPackageId::InitialiseL(TInt& aOffset, TInt aPackageNameLength)
   734 	/**
   814 	/**
   736 	
   816 	
   737 	@param aOffset The running offset of where the descriptor has been parsed up to
   817 	@param aOffset The running offset of where the descriptor has been parsed up to
   738 	@param aPackageNameLength The lenght of the package name
   818 	@param aPackageNameLength The lenght of the package name
   739 	*/
   819 	*/
   740 		{
   820 		{
       
   821 		OstTraceFunctionEntry0( CSBPACKAGEID_INITIALISEL_ENTRY );
   741 		TUid pkgId;
   822 		TUid pkgId;
   742 		TSecureId sid;
   823 		TSecureId sid;
   743 		TPackageName pkgName;
   824 		TPackageName pkgName;
   744 		
   825 		
   745 		CSBGenericDataType::InitialiseL(aOffset);
   826 		CSBGenericDataType::InitialiseL(aOffset);
   756 		aOffset += sizeof(TInt);
   837 		aOffset += sizeof(TInt);
   757 		aOffset += aPackageNameLength * KCharWidthInBytes;
   838 		aOffset += aPackageNameLength * KCharWidthInBytes;
   758 		
   839 		
   759 		// Increment the size of the data buffer
   840 		// Increment the size of the data buffer
   760 		iDataBuffer->Des().SetLength(aOffset);
   841 		iDataBuffer->Des().SetLength(aOffset);
       
   842 		OstTraceFunctionExit0( CSBPACKAGEID_INITIALISEL_EXIT );
   761 		}
   843 		}
   762 		
   844 		
   763 	void CSBPackageId::InitialiseL(TInt& aOffset)
   845 	void CSBPackageId::InitialiseL(TInt& aOffset)
   764 	/**
   846 	/**
   765 	Initialise all member pointers to data
   847 	Initialise all member pointers to data
   766 	
   848 	
   767 	@param aOffset The running offset of where the descriptor has been parsed up to
   849 	@param aOffset The running offset of where the descriptor has been parsed up to
   768 	*/
   850 	*/
   769 		{
   851 		{
       
   852 		OstTraceFunctionEntry0( DUP1_CSBPACKAGEID_INITIALISEL_ENTRY );
   770 		TUid pkgId;
   853 		TUid pkgId;
   771 		TSecureId sid;
   854 		TSecureId sid;
   772 		TPackageName pkgName;
   855 		TPackageName pkgName;
   773 		
   856 		
   774 		CSBGenericDataType::InitialiseL(aOffset);
   857 		CSBGenericDataType::InitialiseL(aOffset);
   788 		aOffset += 4;
   871 		aOffset += 4;
   789 		aOffset += size * KCharWidthInBytes;
   872 		aOffset += size * KCharWidthInBytes;
   790 		
   873 		
   791 		// Increment the size of the data buffer
   874 		// Increment the size of the data buffer
   792 		iDataBuffer->Des().SetLength(aOffset);
   875 		iDataBuffer->Des().SetLength(aOffset);
       
   876 		OstTraceFunctionExit0( DUP1_CSBPACKAGEID_INITIALISEL_EXIT );
   793 		}
   877 		}
   794 		
   878 		
   795 
   879 
   796 	void CSBPackageId::ConstructL(TUid aPackageId, TSecureId aSecureId,
   880 	void CSBPackageId::ConstructL(TUid aPackageId, TSecureId aSecureId,
   797 								  const TDesC& aPackageName)
   881 								  const TDesC& aPackageName)
   801 	@param aPackageId  the package identifier
   885 	@param aPackageId  the package identifier
   802 	@param aSecureId  the secure identifier
   886 	@param aSecureId  the secure identifier
   803 	@param aPackageName  the name of the package
   887 	@param aPackageName  the name of the package
   804 	*/
   888 	*/
   805 		{
   889 		{
       
   890 		OstTraceFunctionEntry0( CSBPACKAGEID_CONSTRUCTL_ENTRY );
   806 		// Call the Base ConstructL in order to allocate the buffer
   891 		// Call the Base ConstructL in order to allocate the buffer
   807 		BaseConstructL();
   892 		BaseConstructL();
   808 		
   893 		
   809 		TInt offset = 0;
   894 		TInt offset = 0;
   810 		
   895 		
   820 		TPackageName packageName(aPackageName);
   905 		TPackageName packageName(aPackageName);
   821 		
   906 		
   822 		PackType(packageId, *iDataBuffer, iPackageIdOffset);
   907 		PackType(packageId, *iDataBuffer, iPackageIdOffset);
   823 		PackType(secureId, *iDataBuffer, iSecureIdOffset);
   908 		PackType(secureId, *iDataBuffer, iSecureIdOffset);
   824 		PackType(packageName, *iDataBuffer, iPackageNameOffset);
   909 		PackType(packageName, *iDataBuffer, iPackageNameOffset);
       
   910 		OstTraceFunctionExit0( CSBPACKAGEID_CONSTRUCTL_EXIT );
   825 		}
   911 		}
   826 
   912 
   827 	void CSBPackageId::ConstructL(CSBGenericDataType* aGenericDataType)
   913 	void CSBPackageId::ConstructL(CSBGenericDataType* aGenericDataType)
   828 	/**
   914 	/**
   829 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
   915 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
   830 
   916 
   831 	@param aGenericDataType  pointer to a CSBGenericDataType object
   917 	@param aGenericDataType  pointer to a CSBGenericDataType object
   832 	*/
   918 	*/
   833 		{
   919 		{
       
   920 		OstTraceFunctionEntry0( DUP1_CSBPACKAGEID_CONSTRUCTL_ENTRY );
   834 		if (aGenericDataType == NULL)
   921 		if (aGenericDataType == NULL)
   835 			{
   922 			{
       
   923 		    OstTrace0(TRACE_ERROR, CSBPACKAGEID_CONSTRUCTL, "Leave: KErrArgument");
   836 			User::Leave(KErrArgument);
   924 			User::Leave(KErrArgument);
   837 			}
   925 			}
   838 		if (EPackageDerivedType != aGenericDataType->DerivedTypeL())
   926 		if (EPackageDerivedType != aGenericDataType->DerivedTypeL())
   839 			{
   927 			{
       
   928 		    OstTrace0(TRACE_ERROR, DUP1_CSBPACKAGEID_CONSTRUCTL, "Leave: KErrArgument");
   840 			User::Leave(KErrArgument);
   929 			User::Leave(KErrArgument);
   841 			}
   930 			}
   842 		const TDesC8& des = aGenericDataType->Externalise();
   931 		const TDesC8& des = aGenericDataType->Externalise();
   843 		
   932 		
   844 		if (des.Size() > iSize)
   933 		if (des.Size() > iSize)
   845 			{
   934 			{
       
   935 		    OstTrace0(TRACE_ERROR, DUP2_CSBPACKAGEID_CONSTRUCTL, "Leave: KErrArgument");
   846 			User::Leave(KErrArgument);
   936 			User::Leave(KErrArgument);
   847 			}
   937 			}
   848 		// Call the base class ConstructL
   938 		// Call the base class ConstructL
   849 		CSBGenericDataType::ConstructL(des);
   939 		CSBGenericDataType::ConstructL(des);
       
   940 		OstTraceFunctionExit0( DUP1_CSBPACKAGEID_CONSTRUCTL_EXIT );
   850 		}
   941 		}
   851 		
   942 		
   852 	EXPORT_C TUid CSBPackageId::PackageIdL() const
   943 	EXPORT_C TUid CSBPackageId::PackageIdL() const
   853 	/**
   944 	/**
   854 	Getter for the package identifier
   945 	Getter for the package identifier
   855 		
   946 		
   856 	@return  The package identifier
   947 	@return  The package identifier
   857 	*/
   948 	*/
   858 		{
   949 		{
       
   950 		OstTraceFunctionEntry0( CSBPACKAGEID_PACKAGEIDL_ENTRY );
   859 		TUid pkgId;
   951 		TUid pkgId;
   860 		
   952 		
   861 		UnpackType(pkgId, *iDataBuffer, iPackageIdOffset);
   953 		UnpackType(pkgId, *iDataBuffer, iPackageIdOffset);
   862 		
   954 		
       
   955 		OstTraceFunctionExit0( CSBPACKAGEID_PACKAGEIDL_EXIT );
   863 		return pkgId;
   956 		return pkgId;
   864 		}
   957 		}
   865 		
   958 		
   866 	EXPORT_C TSecureId CSBPackageId::SecureIdL() const
   959 	EXPORT_C TSecureId CSBPackageId::SecureIdL() const
   867 	/**
   960 	/**
   868 	Getter for the secure identifier
   961 	Getter for the secure identifier
   869 		
   962 		
   870 	@return  The secure identifier
   963 	@return  The secure identifier
   871 	*/
   964 	*/
   872 		{
   965 		{
       
   966 		OstTraceFunctionEntry0( CSBPACKAGEID_SECUREIDL_ENTRY );
   873 		TSecureId secureId;
   967 		TSecureId secureId;
   874 		
   968 		
   875 		UnpackType(secureId, *iDataBuffer, iSecureIdOffset);
   969 		UnpackType(secureId, *iDataBuffer, iSecureIdOffset);
   876 		
   970 		
       
   971 		OstTraceFunctionExit0( CSBPACKAGEID_SECUREIDL_EXIT );
   877 		return secureId;
   972 		return secureId;
   878 		}
   973 		}
   879 
   974 
   880 	EXPORT_C TPackageName CSBPackageId::PackageNameL() const
   975 	EXPORT_C TPackageName CSBPackageId::PackageNameL() const
   881 	/**
   976 	/**
   882 	Getter for the package name
   977 	Getter for the package name
   883 		
   978 		
   884 	@return  Reference to the package name
   979 	@return  Reference to the package name
   885 	*/
   980 	*/
   886 		{
   981 		{
       
   982 		OstTraceFunctionEntry0( CSBPACKAGEID_PACKAGENAMEL_ENTRY );
   887 		TPackageName pkgName;
   983 		TPackageName pkgName;
   888 		
   984 		
   889 		UnpackType(pkgName, *iDataBuffer, iPackageNameOffset);
   985 		UnpackType(pkgName, *iDataBuffer, iPackageNameOffset);
   890 		
   986 		
       
   987 		OstTraceFunctionExit0( CSBPACKAGEID_PACKAGENAMEL_EXIT );
   891 		return pkgName;
   988 		return pkgName;
   892 		}
   989 		}
   893 
   990 
   894 
   991 
   895 	// CSBGenericDataType
   992 	// CSBGenericDataType
   899 
   996 
   900 	@param aDes descriptor containing the buffer of data
   997 	@param aDes descriptor containing the buffer of data
   901 	@return A pointer to the CSBGenericTransferType object
   998 	@return A pointer to the CSBGenericTransferType object
   902 	*/
   999 	*/
   903 		{
  1000 		{
       
  1001 		OstTraceFunctionEntry0( CSBGENERICTRANSFERTYPE_NEWL_ENTRY );
   904 		CSBGenericTransferType* self = new(ELeave) CSBGenericTransferType();
  1002 		CSBGenericTransferType* self = new(ELeave) CSBGenericTransferType();
   905 		CleanupStack::PushL(self);
  1003 		CleanupStack::PushL(self);
   906 		self->CSBGenericDataType::ConstructL(aDes);
  1004 		self->CSBGenericDataType::ConstructL(aDes);
   907 		CleanupStack::Pop(self);
  1005 		CleanupStack::Pop(self);
       
  1006 		OstTraceFunctionExit0( CSBGENERICTRANSFERTYPE_NEWL_EXIT );
   908 		return self;
  1007 		return self;
   909 		}
  1008 		}
   910 
  1009 
   911 	void CSBGenericTransferType::InitialiseL(TInt& aOffset)
  1010 	void CSBGenericTransferType::InitialiseL(TInt& aOffset)
   912 	/**
  1011 	/**
   913 	Initialise all member pointers to data
  1012 	Initialise all member pointers to data
   914 	
  1013 	
   915 	@param aOffset The running offset of where the descriptor has been parsed up to
  1014 	@param aOffset The running offset of where the descriptor has been parsed up to
   916 	*/
  1015 	*/
   917 		{
  1016 		{
       
  1017 		OstTraceFunctionEntry0( CSBGENERICTRANSFERTYPE_INITIALISEL_ENTRY );
   918 		CSBGenericDataType::InitialiseL(aOffset);
  1018 		CSBGenericDataType::InitialiseL(aOffset);
   919 		
  1019 		
   920 		if (iSize < (aOffset + sizeof(TDriveNumber)))
  1020 		if (iSize < (aOffset + sizeof(TDriveNumber)))
   921 			{
  1021 			{
       
  1022 		    OstTrace0(TRACE_ERROR, CSBGENERICTRANSFERTYPE_INITIALISEL, "Leave: KErrCorrupt");
   922 			User::Leave(KErrCorrupt);
  1023 			User::Leave(KErrCorrupt);
   923 			}
  1024 			}
   924 		
  1025 		
   925 		// Dummy data to get sizeof information from
  1026 		// Dummy data to get sizeof information from
   926 		TDriveNumber driveNum;
  1027 		TDriveNumber driveNum;
   928 		iDriveNumberOffset = aOffset;
  1029 		iDriveNumberOffset = aOffset;
   929 		UnpackTypeAdvance(driveNum, *iDataBuffer, aOffset);
  1030 		UnpackTypeAdvance(driveNum, *iDataBuffer, aOffset);
   930 		
  1031 		
   931 		// Increment the size of the data buffer
  1032 		// Increment the size of the data buffer
   932 		iDataBuffer->Des().SetLength(aOffset);
  1033 		iDataBuffer->Des().SetLength(aOffset);
       
  1034 		OstTraceFunctionExit0( CSBGENERICTRANSFERTYPE_INITIALISEL_EXIT );
   933 		}
  1035 		}
   934 	
  1036 	
   935 	CSBGenericTransferType::CSBGenericTransferType()
  1037 	CSBGenericTransferType::CSBGenericTransferType()
   936 	/**
  1038 	/**
   937 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1039 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
   938 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1040 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
   939 	to be large enough to accomodate the data stored by the derived type
  1041 	to be large enough to accomodate the data stored by the derived type
   940 	*/
  1042 	*/
   941 		{
  1043 		{
       
  1044 		OstTraceFunctionEntry0( CSBGENERICTRANSFERTYPE_CSBGENERICTRANSFERTYPE_CONS_ENTRY );
   942 		iSize += sizeof(TDriveNumber);
  1045 		iSize += sizeof(TDriveNumber);
       
  1046 		OstTraceFunctionExit0( CSBGENERICTRANSFERTYPE_CSBGENERICTRANSFERTYPE_CONS_EXIT );
   943 		}
  1047 		}
   944 
  1048 
   945 	EXPORT_C CSBGenericTransferType::~CSBGenericTransferType()
  1049 	EXPORT_C CSBGenericTransferType::~CSBGenericTransferType()
   946 	/**
  1050 	/**
   947 	C++ Destructor
  1051 	C++ Destructor
   948 	*/
  1052 	*/
   949 		{
  1053 		{
       
  1054 		OstTraceFunctionEntry0( CSBGENERICTRANSFERTYPE_CSBGENERICTRANSFERTYPE_DES_ENTRY );
       
  1055 		OstTraceFunctionExit0( CSBGENERICTRANSFERTYPE_CSBGENERICTRANSFERTYPE_DES_EXIT );
   950 		}
  1056 		}
   951 
  1057 
   952 	EXPORT_C TDriveNumber CSBGenericTransferType::DriveNumberL() const
  1058 	EXPORT_C TDriveNumber CSBGenericTransferType::DriveNumberL() const
   953 	/**
  1059 	/**
   954 	Getter method for returning the drive number
  1060 	Getter method for returning the drive number
   955 	
  1061 	
   956 	@return The drive number
  1062 	@return The drive number
   957 	*/
  1063 	*/
   958 		{
  1064 		{
       
  1065 		OstTraceFunctionEntry0( CSBGENERICTRANSFERTYPE_DRIVENUMBERL_ENTRY );
   959 		TDriveNumber driveNum;
  1066 		TDriveNumber driveNum;
   960 		
  1067 		
   961 		UnpackType(driveNum, *iDataBuffer, iDriveNumberOffset);
  1068 		UnpackType(driveNum, *iDataBuffer, iDriveNumberOffset);
   962 		
  1069 		
       
  1070 		OstTraceFunctionExit0( CSBGENERICTRANSFERTYPE_DRIVENUMBERL_EXIT );
   963 		return driveNum;
  1071 		return driveNum;
   964 		}
  1072 		}
   965 		
  1073 		
   966 	// CSBSIDTransferType
  1074 	// CSBSIDTransferType
   967 	EXPORT_C CSBSIDTransferType* CSBSIDTransferType::NewL(TSecureId aSecureId, TDriveNumber aDriveNumber, TTransferDataType aTransferDataType)
  1075 	EXPORT_C CSBSIDTransferType* CSBSIDTransferType::NewL(TSecureId aSecureId, TDriveNumber aDriveNumber, TTransferDataType aTransferDataType)
   973 	@param aDriveNumber the drive that contains the data
  1081 	@param aDriveNumber the drive that contains the data
   974 	@param aTransferDataType the type of the data you wish to transfer
  1082 	@param aTransferDataType the type of the data you wish to transfer
   975 	@return A pointer to the CSBSIDTransferType object
  1083 	@return A pointer to the CSBSIDTransferType object
   976 	*/
  1084 	*/
   977 		{
  1085 		{
       
  1086 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_NEWL_ENTRY );
   978 		CSBSIDTransferType* self = new(ELeave) CSBSIDTransferType();
  1087 		CSBSIDTransferType* self = new(ELeave) CSBSIDTransferType();
   979 		CleanupStack::PushL(self);
  1088 		CleanupStack::PushL(self);
   980 		self->ConstructL(aSecureId, aDriveNumber, aTransferDataType);
  1089 		self->ConstructL(aSecureId, aDriveNumber, aTransferDataType);
   981 		CleanupStack::Pop(self);
  1090 		CleanupStack::Pop(self);
       
  1091 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_NEWL_EXIT );
   982 		return self;
  1092 		return self;
   983 		}
  1093 		}
   984 	
  1094 	
   985 	EXPORT_C CSBSIDTransferType* CSBSIDTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
  1095 	EXPORT_C CSBSIDTransferType* CSBSIDTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
   986 	/**
  1096 	/**
   990 
  1100 
   991 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1101 	@param aGenericTransferType pointer to a CSBGenericTransferType object
   992 	@return A pointer to the CSBSIDTransferType object
  1102 	@return A pointer to the CSBSIDTransferType object
   993 	*/
  1103 	*/
   994 		{
  1104 		{
       
  1105 		OstTraceFunctionEntry0( DUP1_CSBSIDTRANSFERTYPE_NEWL_ENTRY );
   995 		CSBSIDTransferType* self = new(ELeave) CSBSIDTransferType();
  1106 		CSBSIDTransferType* self = new(ELeave) CSBSIDTransferType();
   996 		CleanupStack::PushL(self);
  1107 		CleanupStack::PushL(self);
   997 		self->ConstructL(aGenericTransferType);
  1108 		self->ConstructL(aGenericTransferType);
   998 		CleanupStack::Pop(self);
  1109 		CleanupStack::Pop(self);
       
  1110 		OstTraceFunctionExit0( DUP1_CSBSIDTRANSFERTYPE_NEWL_EXIT );
   999 		return self;
  1111 		return self;
  1000 		}	
  1112 		}	
  1001 	
  1113 	
  1002 	CSBSIDTransferType::CSBSIDTransferType()
  1114 	CSBSIDTransferType::CSBSIDTransferType()
  1003 	/**
  1115 	/**
  1004 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1116 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1005 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1117 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1006 	to be large enough to accomodate the data stored by the derived type
  1118 	to be large enough to accomodate the data stored by the derived type
  1007 	*/
  1119 	*/
  1008 		{
  1120 		{
       
  1121 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_CSBSIDTRANSFERTYPE_CONS_ENTRY );
  1009 		iSize += (sizeof(TSecureId) + sizeof(TTransferDataType));
  1122 		iSize += (sizeof(TSecureId) + sizeof(TTransferDataType));
       
  1123 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_CSBSIDTRANSFERTYPE_CONS_EXIT );
  1010 		}
  1124 		}
  1011 
  1125 
  1012 	EXPORT_C CSBSIDTransferType::~CSBSIDTransferType()
  1126 	EXPORT_C CSBSIDTransferType::~CSBSIDTransferType()
  1013 	/**
  1127 	/**
  1014 	C++ Destructor
  1128 	C++ Destructor
  1015 	*/
  1129 	*/
  1016 		{
  1130 		{
       
  1131 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_CSBSIDTRANSFERTYPE_DES_ENTRY );
       
  1132 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_CSBSIDTRANSFERTYPE_DES_EXIT );
  1017 		}
  1133 		}
  1018 
  1134 
  1019 	void CSBSIDTransferType::InitialiseL(TInt& aOffset)
  1135 	void CSBSIDTransferType::InitialiseL(TInt& aOffset)
  1020 	/**
  1136 	/**
  1021 	Initialise all member pointers to data
  1137 	Initialise all member pointers to data
  1022 	
  1138 	
  1023 	@param aOffset The running offset of where the descriptor has been parsed up to
  1139 	@param aOffset The running offset of where the descriptor has been parsed up to
  1024 	*/
  1140 	*/
  1025 		{
  1141 		{
       
  1142 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_INITIALISEL_ENTRY );
  1026 		CSBGenericTransferType::InitialiseL(aOffset);
  1143 		CSBGenericTransferType::InitialiseL(aOffset);
  1027 
  1144 
  1028 		TSecureId sid;
  1145 		TSecureId sid;
  1029 		TTransferDataType transType;
  1146 		TTransferDataType transType;
  1030 
  1147 
  1034 		iTransferDataTypeOffset = aOffset;
  1151 		iTransferDataTypeOffset = aOffset;
  1035 		UnpackTypeAdvance(transType, *iDataBuffer, aOffset);
  1152 		UnpackTypeAdvance(transType, *iDataBuffer, aOffset);
  1036 		
  1153 		
  1037 		// Increment the size of the data buffer
  1154 		// Increment the size of the data buffer
  1038 		iDataBuffer->Des().SetLength(aOffset);
  1155 		iDataBuffer->Des().SetLength(aOffset);
       
  1156 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_INITIALISEL_EXIT );
  1039 		}
  1157 		}
  1040 
  1158 
  1041 	void CSBSIDTransferType::ConstructL(TSecureId aSecureId, TDriveNumber aDriveNumber,
  1159 	void CSBSIDTransferType::ConstructL(TSecureId aSecureId, TDriveNumber aDriveNumber,
  1042 										TTransferDataType aTransferDataType)
  1160 										TTransferDataType aTransferDataType)
  1043 	/**
  1161 	/**
  1046 	@param aSecureId the secure identifier
  1164 	@param aSecureId the secure identifier
  1047 	@param aDriveNumber the drive that contains the data
  1165 	@param aDriveNumber the drive that contains the data
  1048 	@param aTransferDataType the type of the data you wish to transfer
  1166 	@param aTransferDataType the type of the data you wish to transfer
  1049 	*/
  1167 	*/
  1050 		{
  1168 		{
       
  1169 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_CONSTRUCTL_ENTRY );
  1051 		TInt offset = 0;
  1170 		TInt offset = 0;
  1052 
  1171 
  1053 		BaseConstructL();
  1172 		BaseConstructL();
  1054 
  1173 
  1055 		TSBDerivedType derivedType = ESIDTransferDerivedType;
  1174 		TSBDerivedType derivedType = ESIDTransferDerivedType;
  1062 		TTransferDataType transType = aTransferDataType;
  1181 		TTransferDataType transType = aTransferDataType;
  1063 
  1182 
  1064 		PackType(driveNum, *iDataBuffer, iDriveNumberOffset);
  1183 		PackType(driveNum, *iDataBuffer, iDriveNumberOffset);
  1065 		PackType(sid, *iDataBuffer, iSecureIdOffset);
  1184 		PackType(sid, *iDataBuffer, iSecureIdOffset);
  1066 		PackType(transType, *iDataBuffer, iTransferDataTypeOffset);
  1185 		PackType(transType, *iDataBuffer, iTransferDataTypeOffset);
       
  1186 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_CONSTRUCTL_EXIT );
  1067 		}
  1187 		}
  1068 
  1188 
  1069 	void CSBSIDTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1189 	void CSBSIDTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1070 	/**
  1190 	/**
  1071 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1191 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1072 
  1192 
  1073 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1193 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1074 	*/
  1194 	*/
  1075 		{
  1195 		{
       
  1196 		OstTraceFunctionEntry0( DUP1_CSBSIDTRANSFERTYPE_CONSTRUCTL_ENTRY );
  1076 		if (aGenericTransferType == NULL)
  1197 		if (aGenericTransferType == NULL)
  1077 			{
  1198 			{
       
  1199 		    OstTrace0(TRACE_ERROR, CSBSIDTRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1078 			User::Leave(KErrArgument);
  1200 			User::Leave(KErrArgument);
  1079 			}
  1201 			}
  1080 		if (ESIDTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1202 		if (ESIDTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1081 			{
  1203 			{
       
  1204 		    OstTrace0(TRACE_ERROR, DUP1_CSBSIDTRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1082 			User::Leave(KErrArgument);
  1205 			User::Leave(KErrArgument);
  1083 			}
  1206 			}
  1084 		// If the descriptor is different to the size we're expecting then it's not correct
  1207 		// If the descriptor is different to the size we're expecting then it's not correct
  1085 		const TDesC8& des = aGenericTransferType->Externalise();
  1208 		const TDesC8& des = aGenericTransferType->Externalise();
  1086 		if (des.Size() != iSize)
  1209 		if (des.Size() != iSize)
  1087 			{
  1210 			{
       
  1211 		    OstTrace0(TRACE_ERROR, DUP2_CSBSIDTRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1088 			User::Leave(KErrArgument);
  1212 			User::Leave(KErrArgument);
  1089 			}
  1213 			}
  1090 		
  1214 		
  1091 		// Call the base class ConstructL
  1215 		// Call the base class ConstructL
  1092 		CSBGenericDataType::ConstructL(des);
  1216 		CSBGenericDataType::ConstructL(des);
       
  1217 		OstTraceFunctionExit0( DUP1_CSBSIDTRANSFERTYPE_CONSTRUCTL_EXIT );
  1093 		}
  1218 		}
  1094 		
  1219 		
  1095 	EXPORT_C TSecureId CSBSIDTransferType::SecureIdL() const
  1220 	EXPORT_C TSecureId CSBSIDTransferType::SecureIdL() const
  1096 	/**
  1221 	/**
  1097 	Getter for the secure identifier
  1222 	Getter for the secure identifier
  1098 		
  1223 		
  1099 	@return  The secure identifier
  1224 	@return  The secure identifier
  1100 	*/
  1225 	*/
  1101 		{
  1226 		{
       
  1227 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_SECUREIDL_ENTRY );
  1102 		TSecureId sid;
  1228 		TSecureId sid;
  1103 		
  1229 		
  1104 		UnpackType(sid, *iDataBuffer, iSecureIdOffset);
  1230 		UnpackType(sid, *iDataBuffer, iSecureIdOffset);
  1105 		
  1231 		
       
  1232 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_SECUREIDL_EXIT );
  1106 		return sid;
  1233 		return sid;
  1107 		}
  1234 		}
  1108 
  1235 
  1109 	EXPORT_C TTransferDataType CSBSIDTransferType::DataTypeL() const
  1236 	EXPORT_C TTransferDataType CSBSIDTransferType::DataTypeL() const
  1110 	/**
  1237 	/**
  1111 	Getter for the transfer data type
  1238 	Getter for the transfer data type
  1112 		
  1239 		
  1113 	@return  The transfer data type
  1240 	@return  The transfer data type
  1114 	*/
  1241 	*/
  1115 		{
  1242 		{
       
  1243 		OstTraceFunctionEntry0( CSBSIDTRANSFERTYPE_DATATYPEL_ENTRY );
  1116 		TTransferDataType transType;
  1244 		TTransferDataType transType;
  1117 		
  1245 		
  1118 		UnpackType(transType, *iDataBuffer, iTransferDataTypeOffset);
  1246 		UnpackType(transType, *iDataBuffer, iTransferDataTypeOffset);
  1119 
  1247 
       
  1248 		OstTraceFunctionExit0( CSBSIDTRANSFERTYPE_DATATYPEL_EXIT );
  1120 		return transType;
  1249 		return transType;
  1121 		}
  1250 		}
  1122 		
  1251 		
  1123 		
  1252 		
  1124 	// CSBPackageTransferType
  1253 	// CSBPackageTransferType
  1132 	@param aDriveNumber the drive that contains the data
  1261 	@param aDriveNumber the drive that contains the data
  1133 	@param aPackageDataType the type of the package data
  1262 	@param aPackageDataType the type of the package data
  1134 	@return A pointer to the CSBPackageTransferType object
  1263 	@return A pointer to the CSBPackageTransferType object
  1135 	*/
  1264 	*/
  1136 		{
  1265 		{
       
  1266 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_NEWL_ENTRY );
  1137 		CSBPackageTransferType* self = new(ELeave) CSBPackageTransferType();
  1267 		CSBPackageTransferType* self = new(ELeave) CSBPackageTransferType();
  1138 		CleanupStack::PushL(self);
  1268 		CleanupStack::PushL(self);
  1139 		self->ConstructL(aPackageId, aDriveNumber, aPackageDataType);
  1269 		self->ConstructL(aPackageId, aDriveNumber, aPackageDataType);
  1140 		CleanupStack::Pop(self);
  1270 		CleanupStack::Pop(self);
       
  1271 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_NEWL_EXIT );
  1141 		return self;
  1272 		return self;
  1142 		}
  1273 		}
  1143 	
  1274 	
  1144 	EXPORT_C CSBPackageTransferType* CSBPackageTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
  1275 	EXPORT_C CSBPackageTransferType* CSBPackageTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
  1145 	/**
  1276 	/**
  1149 
  1280 
  1150 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1281 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1151 	@return A pointer to the CSBPackageTransferType object
  1282 	@return A pointer to the CSBPackageTransferType object
  1152 	*/
  1283 	*/
  1153 		{
  1284 		{
       
  1285 		OstTraceFunctionEntry0( DUP1_CSBPACKAGETRANSFERTYPE_NEWL_ENTRY );
  1154 		CSBPackageTransferType* self = new(ELeave) CSBPackageTransferType();
  1286 		CSBPackageTransferType* self = new(ELeave) CSBPackageTransferType();
  1155 		CleanupStack::PushL(self);
  1287 		CleanupStack::PushL(self);
  1156 		self->ConstructL(aGenericTransferType);
  1288 		self->ConstructL(aGenericTransferType);
  1157 		CleanupStack::Pop(self);
  1289 		CleanupStack::Pop(self);
       
  1290 		OstTraceFunctionExit0( DUP1_CSBPACKAGETRANSFERTYPE_NEWL_EXIT );
  1158 		return self;
  1291 		return self;
  1159 		}	
  1292 		}	
  1160 	
  1293 	
  1161 	CSBPackageTransferType::CSBPackageTransferType()
  1294 	CSBPackageTransferType::CSBPackageTransferType()
  1162 	/**
  1295 	/**
  1163 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1296 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1164 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1297 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1165 	to be large enough to accomodate the data stored by the derived type
  1298 	to be large enough to accomodate the data stored by the derived type
  1166 	*/
  1299 	*/
  1167 		{
  1300 		{
       
  1301 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_CSBPACKAGETRANSFERTYPE_CONS_ENTRY );
  1168 		iSize += (sizeof(TUid) + sizeof(TPackageDataType));
  1302 		iSize += (sizeof(TUid) + sizeof(TPackageDataType));
       
  1303 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_CSBPACKAGETRANSFERTYPE_CONS_EXIT );
  1169 		}
  1304 		}
  1170 
  1305 
  1171 	void CSBPackageTransferType::InitialiseL(TInt& aOffset)
  1306 	void CSBPackageTransferType::InitialiseL(TInt& aOffset)
  1172 	/**
  1307 	/**
  1173 	Initialise all member pointers to data
  1308 	Initialise all member pointers to data
  1174 	
  1309 	
  1175 	@param aOffset The running offset of where the descriptor has been parsed up to
  1310 	@param aOffset The running offset of where the descriptor has been parsed up to
  1176 	*/
  1311 	*/
  1177 		{
  1312 		{
       
  1313 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_INITIALISEL_ENTRY );
  1178 		CSBGenericTransferType::InitialiseL(aOffset);
  1314 		CSBGenericTransferType::InitialiseL(aOffset);
  1179 
  1315 
  1180 		TUid pkgId;
  1316 		TUid pkgId;
  1181 		TPackageDataType pkgDataType;
  1317 		TPackageDataType pkgDataType;
  1182 		
  1318 		
  1186 		iPackageDataTypeOffset = aOffset;
  1322 		iPackageDataTypeOffset = aOffset;
  1187 		UnpackTypeAdvance(pkgDataType, *iDataBuffer, aOffset);
  1323 		UnpackTypeAdvance(pkgDataType, *iDataBuffer, aOffset);
  1188 		
  1324 		
  1189 		// Increment the size of the data buffer
  1325 		// Increment the size of the data buffer
  1190 		iDataBuffer->Des().SetLength(aOffset);
  1326 		iDataBuffer->Des().SetLength(aOffset);
       
  1327 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_INITIALISEL_EXIT );
  1191 		}
  1328 		}
  1192 
  1329 
  1193 	EXPORT_C CSBPackageTransferType::~CSBPackageTransferType()
  1330 	EXPORT_C CSBPackageTransferType::~CSBPackageTransferType()
  1194 	/**
  1331 	/**
  1195 	C++ Destructor
  1332 	C++ Destructor
  1196 	*/
  1333 	*/
  1197 		{
  1334 		{
       
  1335 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_CSBPACKAGETRANSFERTYPE_DES_ENTRY );
       
  1336 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_CSBPACKAGETRANSFERTYPE_DES_EXIT );
  1198 		}
  1337 		}
  1199 
  1338 
  1200 	void CSBPackageTransferType::ConstructL(TUid aPackageId, TDriveNumber aDriveNumber,
  1339 	void CSBPackageTransferType::ConstructL(TUid aPackageId, TDriveNumber aDriveNumber,
  1201 										TPackageDataType aPackageDataType)
  1340 										TPackageDataType aPackageDataType)
  1202 	/**
  1341 	/**
  1205 	@param aPackageId the secure identifier
  1344 	@param aPackageId the secure identifier
  1206 	@param aDriveNumber the drive that contains the data
  1345 	@param aDriveNumber the drive that contains the data
  1207 	@param aPackageDataType the type of the data you wish to transfer
  1346 	@param aPackageDataType the type of the data you wish to transfer
  1208 	*/
  1347 	*/
  1209 		{
  1348 		{
       
  1349 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_CONSTRUCTL_ENTRY );
  1210 		TInt offset = 0;
  1350 		TInt offset = 0;
  1211 
  1351 
  1212 		BaseConstructL();
  1352 		BaseConstructL();
  1213 
  1353 
  1214 		TSBDerivedType derivedType = EPackageTransferDerivedType;
  1354 		TSBDerivedType derivedType = EPackageTransferDerivedType;
  1221 		TUid pkgId = aPackageId;
  1361 		TUid pkgId = aPackageId;
  1222 		
  1362 		
  1223 		PackType(driveNum, *iDataBuffer, iDriveNumberOffset);
  1363 		PackType(driveNum, *iDataBuffer, iDriveNumberOffset);
  1224 		PackType(pkgId, *iDataBuffer, iPackageIdOffset);
  1364 		PackType(pkgId, *iDataBuffer, iPackageIdOffset);
  1225 		PackType(pkgDataType, *iDataBuffer, iPackageDataTypeOffset);
  1365 		PackType(pkgDataType, *iDataBuffer, iPackageDataTypeOffset);
       
  1366 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_CONSTRUCTL_EXIT );
  1226 		}
  1367 		}
  1227 
  1368 
  1228 	void CSBPackageTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1369 	void CSBPackageTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1229 	/**
  1370 	/**
  1230 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1371 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1231 
  1372 
  1232 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1373 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1233 	*/
  1374 	*/
  1234 		{
  1375 		{
       
  1376 		OstTraceFunctionEntry0( DUP1_CSBPACKAGETRANSFERTYPE_CONSTRUCTL_ENTRY );
  1235 		if (aGenericTransferType == NULL)
  1377 		if (aGenericTransferType == NULL)
  1236 			{
  1378 			{
       
  1379 		    OstTrace0(TRACE_ERROR, CSBPACKAGETRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1237 			User::Leave(KErrArgument);
  1380 			User::Leave(KErrArgument);
  1238 			}
  1381 			}
  1239 		if (EPackageTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1382 		if (EPackageTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1240 			{
  1383 			{
       
  1384 		    OstTrace0(TRACE_ERROR, DUP1_CSBPACKAGETRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1241 			User::Leave(KErrArgument);
  1385 			User::Leave(KErrArgument);
  1242 			}
  1386 			}
  1243 		// If the descriptor is different to the size we're expecting then it's not correct
  1387 		// If the descriptor is different to the size we're expecting then it's not correct
  1244 		const TDesC8& des = aGenericTransferType->Externalise();
  1388 		const TDesC8& des = aGenericTransferType->Externalise();
  1245 		
  1389 		
  1246 		if (des.Size() != iSize)
  1390 		if (des.Size() != iSize)
  1247 			{
  1391 			{
       
  1392 		    OstTrace0(TRACE_ERROR, DUP2_CSBPACKAGETRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1248 			User::Leave(KErrArgument);
  1393 			User::Leave(KErrArgument);
  1249 			}
  1394 			}
  1250 		
  1395 		
  1251 		// Call the base class ConstructL
  1396 		// Call the base class ConstructL
  1252 		CSBGenericDataType::ConstructL(des);
  1397 		CSBGenericDataType::ConstructL(des);
       
  1398 		OstTraceFunctionExit0( DUP1_CSBPACKAGETRANSFERTYPE_CONSTRUCTL_EXIT );
  1253 		}
  1399 		}
  1254 		
  1400 		
  1255 	EXPORT_C TUid CSBPackageTransferType::PackageIdL() const
  1401 	EXPORT_C TUid CSBPackageTransferType::PackageIdL() const
  1256 	/**
  1402 	/**
  1257 	Getter for the package identifier
  1403 	Getter for the package identifier
  1258 		
  1404 		
  1259 	@return  The package identifier
  1405 	@return  The package identifier
  1260 	*/
  1406 	*/
  1261 		{
  1407 		{
       
  1408 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_PACKAGEIDL_ENTRY );
  1262 		TUid pkgId;
  1409 		TUid pkgId;
  1263 		
  1410 		
  1264 		UnpackType(pkgId, *iDataBuffer, iPackageIdOffset);
  1411 		UnpackType(pkgId, *iDataBuffer, iPackageIdOffset);
  1265 		
  1412 		
       
  1413 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_PACKAGEIDL_EXIT );
  1266 		return pkgId;
  1414 		return pkgId;
  1267 		}
  1415 		}
  1268 
  1416 
  1269 	EXPORT_C TPackageDataType CSBPackageTransferType::DataTypeL() const
  1417 	EXPORT_C TPackageDataType CSBPackageTransferType::DataTypeL() const
  1270 	/**
  1418 	/**
  1271 	Getter for the package data type
  1419 	Getter for the package data type
  1272 		
  1420 		
  1273 	@return  The package data type
  1421 	@return  The package data type
  1274 	*/
  1422 	*/
  1275 		{
  1423 		{
       
  1424 		OstTraceFunctionEntry0( CSBPACKAGETRANSFERTYPE_DATATYPEL_ENTRY );
  1276 		TPackageDataType pkgDataType;
  1425 		TPackageDataType pkgDataType;
  1277 		
  1426 		
  1278 		UnpackType(pkgDataType, *iDataBuffer, iPackageDataTypeOffset);
  1427 		UnpackType(pkgDataType, *iDataBuffer, iPackageDataTypeOffset);
  1279 		
  1428 		
       
  1429 		OstTraceFunctionExit0( CSBPACKAGETRANSFERTYPE_DATATYPEL_EXIT );
  1280 		return pkgDataType;
  1430 		return pkgDataType;
  1281 		}
  1431 		}
  1282 		
  1432 		
  1283 // JavaID
  1433 // JavaID
  1284 
  1434 
  1293 	@param aSuiteVersion  the version of the java suite
  1443 	@param aSuiteVersion  the version of the java suite
  1294 	@param aSuiteHash the hash of the java suite
  1444 	@param aSuiteHash the hash of the java suite
  1295 	@return A pointer to the CSBJavaId object
  1445 	@return A pointer to the CSBJavaId object
  1296 	*/
  1446 	*/
  1297 		{
  1447 		{
       
  1448 		OstTraceFunctionEntry0( CSBJAVAID_NEWL_ENTRY );
  1298 		CSBJavaId* self = new(ELeave) CSBJavaId(aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
  1449 		CSBJavaId* self = new(ELeave) CSBJavaId(aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
  1299 		CleanupStack::PushL(self);
  1450 		CleanupStack::PushL(self);
  1300 		self->ConstructL(aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
  1451 		self->ConstructL(aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
  1301 		CleanupStack::Pop(self);
  1452 		CleanupStack::Pop(self);
       
  1453 		OstTraceFunctionExit0( CSBJAVAID_NEWL_EXIT );
  1302 		return self;
  1454 		return self;
  1303 		}
  1455 		}
  1304 	
  1456 	
  1305 	EXPORT_C CSBJavaId* CSBJavaId::NewL(CSBGenericDataType* aGenericDataType)
  1457 	EXPORT_C CSBJavaId* CSBJavaId::NewL(CSBGenericDataType* aGenericDataType)
  1306 	/**
  1458 	/**
  1310 
  1462 
  1311 	@param aGenericDataType  pointer to a CSBGenericDataType object
  1463 	@param aGenericDataType  pointer to a CSBGenericDataType object
  1312 	@return A pointer to the CSBJavaId object
  1464 	@return A pointer to the CSBJavaId object
  1313 	*/
  1465 	*/
  1314 		{
  1466 		{
       
  1467 		OstTraceFunctionEntry0( DUP1_CSBJAVAID_NEWL_ENTRY );
  1315 		CSBJavaId* self = new(ELeave) CSBJavaId;
  1468 		CSBJavaId* self = new(ELeave) CSBJavaId;
  1316 		CleanupStack::PushL(self);
  1469 		CleanupStack::PushL(self);
  1317 		self->ConstructFromExistingL(aGenericDataType);
  1470 		self->ConstructFromExistingL(aGenericDataType);
  1318 		CleanupStack::Pop(self);
  1471 		CleanupStack::Pop(self);
       
  1472 		OstTraceFunctionExit0( DUP1_CSBJAVAID_NEWL_EXIT );
  1319 		return self;
  1473 		return self;
  1320 		}	
  1474 		}	
  1321 		
  1475 		
  1322 	CSBJavaId::CSBJavaId()
  1476 	CSBJavaId::CSBJavaId()
  1323 		{
  1477 		{
       
  1478 		OstTraceFunctionEntry0( CSBJAVAID_CSBJAVAID_CONS_ENTRY );
       
  1479 		OstTraceFunctionExit0( CSBJAVAID_CSBJAVAID_CONS_EXIT );
  1324 		}
  1480 		}
  1325 	
  1481 	
  1326 	CSBJavaId::CSBJavaId(const TDesC& aSuiteName, const TDesC& aSuiteVendor,
  1482 	CSBJavaId::CSBJavaId(const TDesC& aSuiteName, const TDesC& aSuiteVendor,
  1327 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1483 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1328 	/**
  1484 	/**
  1334 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1490 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1335 	@param aSuiteHash The Java MIDlet suite hash
  1491 	@param aSuiteHash The Java MIDlet suite hash
  1336 	@param aSuiteVersion The version of the MIDlet suite
  1492 	@param aSuiteVersion The version of the MIDlet suite
  1337 	*/
  1493 	*/
  1338 		{
  1494 		{
       
  1495 		OstTraceFunctionEntry0( DUP1_CSBJAVAID_CSBJAVAID_CONS_ENTRY );
  1339 		iSize += (4 * sizeof(TUint32)) + aSuiteName.Size() + aSuiteVendor.Size() + aSuiteVersion.Size() 
  1496 		iSize += (4 * sizeof(TUint32)) + aSuiteName.Size() + aSuiteVendor.Size() + aSuiteVersion.Size() 
  1340 			+ aSuiteHash.Size();
  1497 			+ aSuiteHash.Size();
       
  1498 		OstTraceFunctionExit0( DUP1_CSBJAVAID_CSBJAVAID_CONS_EXIT );
  1341 		}
  1499 		}
  1342 
  1500 
  1343 	EXPORT_C CSBJavaId::~CSBJavaId()
  1501 	EXPORT_C CSBJavaId::~CSBJavaId()
  1344 	/**
  1502 	/**
  1345 	C++ Destructor
  1503 	C++ Destructor
  1346 	*/
  1504 	*/
  1347 		{
  1505 		{
       
  1506 		OstTraceFunctionEntry0( CSBJAVAID_CSBJAVAID_DES_ENTRY );
       
  1507 		OstTraceFunctionExit0( CSBJAVAID_CSBJAVAID_DES_EXIT );
  1348 		}
  1508 		}
  1349 
  1509 
  1350 	void CSBJavaId::InitialiseL(TInt& aOffset)
  1510 	void CSBJavaId::InitialiseL(TInt& aOffset)
  1351 	/**
  1511 	/**
  1352 	Initialise all member pointers to data
  1512 	Initialise all member pointers to data
  1353 	
  1513 	
  1354 	@param aOffset The running offset of where the descriptor has been parsed up to
  1514 	@param aOffset The running offset of where the descriptor has been parsed up to
  1355 	*/
  1515 	*/
  1356 		{
  1516 		{
       
  1517 		OstTraceFunctionEntry0( CSBJAVAID_INITIALISEL_ENTRY );
  1357 		CSBGenericDataType::InitialiseL(aOffset);
  1518 		CSBGenericDataType::InitialiseL(aOffset);
  1358 		
  1519 		
  1359 		UnpackTPtrAdvance(iSuiteName, aOffset);
  1520 		UnpackTPtrAdvance(iSuiteName, aOffset);
  1360 		UnpackTPtrAdvance(iSuiteVendor, aOffset);
  1521 		UnpackTPtrAdvance(iSuiteVendor, aOffset);
  1361 		UnpackTPtrAdvance(iSuiteVersion, aOffset);
  1522 		UnpackTPtrAdvance(iSuiteVersion, aOffset);
  1362 		UnpackTPtrAdvance(iSuiteHash, aOffset);
  1523 		UnpackTPtrAdvance(iSuiteHash, aOffset);
  1363 
  1524 
  1364 		// Increment the size of the data buffer
  1525 		// Increment the size of the data buffer
  1365 		iDataBuffer->Des().SetLength(aOffset);
  1526 		iDataBuffer->Des().SetLength(aOffset);
       
  1527 		OstTraceFunctionExit0( CSBJAVAID_INITIALISEL_EXIT );
  1366 		}
  1528 		}
  1367 
  1529 
  1368 	void CSBJavaId::InitialiseL(TInt& aOffset, const TDesC& aSuiteName, const TDesC& aSuiteVendor,
  1530 	void CSBJavaId::InitialiseL(TInt& aOffset, const TDesC& aSuiteName, const TDesC& aSuiteVendor,
  1369 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1531 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1370 	/**
  1532 	/**
  1375 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1537 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1376 	@param aSuiteHash The Java MIDlet suite hash
  1538 	@param aSuiteHash The Java MIDlet suite hash
  1377 	@param aSuiteVersion The version of the MIDlet suite
  1539 	@param aSuiteVersion The version of the MIDlet suite
  1378 	*/
  1540 	*/
  1379 		{
  1541 		{
       
  1542 		OstTraceFunctionEntry0( DUP1_CSBJAVAID_INITIALISEL_ENTRY );
  1380 		TSBDerivedType derivedType = EJavaDerivedType;
  1543 		TSBDerivedType derivedType = EJavaDerivedType;
  1381 		
  1544 		
  1382 		PackType(derivedType, *iDataBuffer, aOffset);
  1545 		PackType(derivedType, *iDataBuffer, aOffset);
  1383 		
  1546 		
  1384 		CSBGenericDataType::InitialiseL(aOffset);
  1547 		CSBGenericDataType::InitialiseL(aOffset);
  1397 		UnpackTPtrAdvance(iSuiteVersion, ptrOffset);
  1560 		UnpackTPtrAdvance(iSuiteVersion, ptrOffset);
  1398 		UnpackTPtrAdvance(iSuiteHash, ptrOffset);
  1561 		UnpackTPtrAdvance(iSuiteHash, ptrOffset);
  1399 		
  1562 		
  1400 		// Increment the size of the data buffer
  1563 		// Increment the size of the data buffer
  1401 		iDataBuffer->Des().SetLength(aOffset);
  1564 		iDataBuffer->Des().SetLength(aOffset);
       
  1565 		OstTraceFunctionExit0( DUP1_CSBJAVAID_INITIALISEL_EXIT );
  1402 		}
  1566 		}
  1403 		
  1567 		
  1404 	void CSBJavaId::ConstructL(const TDesC& aSuiteName, const TDesC& aSuiteVendor, 
  1568 	void CSBJavaId::ConstructL(const TDesC& aSuiteName, const TDesC& aSuiteVendor, 
  1405 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1569 		const TDesC& aSuiteVersion, const TDesC& aSuiteHash)
  1406 	/**
  1570 	/**
  1410 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1574 	@param aSuiteVendor The name of the vendor of the MIDlet suiet
  1411 	@param aSuiteHash The Java MIDlet suite hash
  1575 	@param aSuiteHash The Java MIDlet suite hash
  1412 	@param aSuiteVersion The version of the MIDlet suite
  1576 	@param aSuiteVersion The version of the MIDlet suite
  1413 	*/
  1577 	*/
  1414 		{
  1578 		{
       
  1579 		OstTraceFunctionEntry0( CSBJAVAID_CONSTRUCTL_ENTRY );
  1415 		// Call the Base ConstructL in order to allocate the buffer
  1580 		// Call the Base ConstructL in order to allocate the buffer
  1416 		BaseConstructL();
  1581 		BaseConstructL();
  1417 		
  1582 		
  1418 		TInt offset = 0;
  1583 		TInt offset = 0;
  1419 		
  1584 		
  1420 		// Initialise all member pointers right up the inheritence tree
  1585 		// Initialise all member pointers right up the inheritence tree
  1421 		InitialiseL(offset, aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
  1586 		InitialiseL(offset, aSuiteName, aSuiteVendor, aSuiteVersion, aSuiteHash);
       
  1587 		OstTraceFunctionExit0( CSBJAVAID_CONSTRUCTL_EXIT );
  1422 		}
  1588 		}
  1423 
  1589 
  1424 	void CSBJavaId::ConstructFromExistingL(CSBGenericDataType* aGenericDataType)
  1590 	void CSBJavaId::ConstructFromExistingL(CSBGenericDataType* aGenericDataType)
  1425 	/**
  1591 	/**
  1426 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1592 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1427 
  1593 
  1428 	@param aGenericDataType  pointer to a CSBGenericDataType object
  1594 	@param aGenericDataType  pointer to a CSBGenericDataType object
  1429 	*/
  1595 	*/
  1430 		{
  1596 		{
       
  1597 		OstTraceFunctionEntry0( CSBJAVAID_CONSTRUCTFROMEXISTINGL_ENTRY );
  1431 		if (aGenericDataType == NULL)
  1598 		if (aGenericDataType == NULL)
  1432 			{
  1599 			{
       
  1600 		    OstTrace0(TRACE_ERROR, CSBJAVAID_CONSTRUCTFROMEXISTINGL, "Leave: KErrArgument");
  1433 			User::Leave(KErrArgument);
  1601 			User::Leave(KErrArgument);
  1434 			}
  1602 			}
  1435 		if (EJavaDerivedType != aGenericDataType->DerivedTypeL())
  1603 		if (EJavaDerivedType != aGenericDataType->DerivedTypeL())
  1436 			{
  1604 			{
       
  1605 		    OstTrace0(TRACE_ERROR, DUP1_CSBJAVAID_CONSTRUCTFROMEXISTINGL, "Leave: KErrArgument");
  1437 			User::Leave(KErrArgument);
  1606 			User::Leave(KErrArgument);
  1438 			}
  1607 			}
  1439 		// Call the base class ConstructL
  1608 		// Call the base class ConstructL
  1440 		CSBGenericDataType::ConstructL(aGenericDataType->Externalise());
  1609 		CSBGenericDataType::ConstructL(aGenericDataType->Externalise());
       
  1610 		OstTraceFunctionExit0( CSBJAVAID_CONSTRUCTFROMEXISTINGL_EXIT );
  1441 		}
  1611 		}
  1442 		
  1612 		
  1443 	EXPORT_C const TDesC& CSBJavaId::SuiteNameL() const
  1613 	EXPORT_C const TDesC& CSBJavaId::SuiteNameL() const
  1444 	/**
  1614 	/**
  1445 	Getter for the MIDlet suite name
  1615 	Getter for the MIDlet suite name
  1490 	@param aDriveNumber the drive that contains the data
  1660 	@param aDriveNumber the drive that contains the data
  1491 	@param aTransferDataType the type of the data you wish to transfer
  1661 	@param aTransferDataType the type of the data you wish to transfer
  1492 	@return A pointer to the CSBJavaTransferType object
  1662 	@return A pointer to the CSBJavaTransferType object
  1493 	*/
  1663 	*/
  1494 		{
  1664 		{
       
  1665 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_NEWL_ENTRY );
  1495 		CSBJavaTransferType* self = new(ELeave) CSBJavaTransferType(aSuiteHash);
  1666 		CSBJavaTransferType* self = new(ELeave) CSBJavaTransferType(aSuiteHash);
  1496 		CleanupStack::PushL(self);
  1667 		CleanupStack::PushL(self);
  1497 		self->ConstructL(aSuiteHash, aDriveNumber, aTransferDataType);
  1668 		self->ConstructL(aSuiteHash, aDriveNumber, aTransferDataType);
  1498 		CleanupStack::Pop(self);
  1669 		CleanupStack::Pop(self);
       
  1670 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_NEWL_EXIT );
  1499 		return self;
  1671 		return self;
  1500 		}
  1672 		}
  1501 	
  1673 	
  1502 	EXPORT_C CSBJavaTransferType* CSBJavaTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
  1674 	EXPORT_C CSBJavaTransferType* CSBJavaTransferType::NewL(CSBGenericTransferType* aGenericTransferType)
  1503 	/**
  1675 	/**
  1507 
  1679 
  1508 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1680 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1509 	@return A pointer to the CSBJavaTransferType object
  1681 	@return A pointer to the CSBJavaTransferType object
  1510 	*/
  1682 	*/
  1511 		{
  1683 		{
       
  1684 		OstTraceFunctionEntry0( DUP1_CSBJAVATRANSFERTYPE_NEWL_ENTRY );
  1512 		CSBJavaTransferType* self = new(ELeave) CSBJavaTransferType;
  1685 		CSBJavaTransferType* self = new(ELeave) CSBJavaTransferType;
  1513 		CleanupStack::PushL(self);
  1686 		CleanupStack::PushL(self);
  1514 		self->ConstructL(aGenericTransferType);
  1687 		self->ConstructL(aGenericTransferType);
  1515 		CleanupStack::Pop(self);
  1688 		CleanupStack::Pop(self);
       
  1689 		OstTraceFunctionExit0( DUP1_CSBJAVATRANSFERTYPE_NEWL_EXIT );
  1516 		return self;
  1690 		return self;
  1517 		}
  1691 		}
  1518 		
  1692 		
  1519 	CSBJavaTransferType::CSBJavaTransferType()
  1693 	CSBJavaTransferType::CSBJavaTransferType()
  1520 	/**
  1694 	/**
  1521 	C++ Constructor
  1695 	C++ Constructor
  1522 	*/
  1696 	*/
  1523 		{
  1697 		{
       
  1698 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_CONS_ENTRY );
       
  1699 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_CONS_EXIT );
  1524 		}
  1700 		}
  1525 	
  1701 	
  1526 	CSBJavaTransferType::CSBJavaTransferType(const TDesC& aSuiteHash)
  1702 	CSBJavaTransferType::CSBJavaTransferType(const TDesC& aSuiteHash)
  1527 	/**
  1703 	/**
  1528 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1704 	C++ Constructor. Any derived types must increment iSize in their C++ constructors in order 
  1529 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1705 	that when CSBGenericDataType::BaseConstructL() is called, the data buffer is initialised 
  1530 	to be large enough to accomodate the data stored by the derived type
  1706 	to be large enough to accomodate the data stored by the derived type
  1531 	*/
  1707 	*/
  1532 		{
  1708 		{
       
  1709 		OstTraceFunctionEntry0( DUP1_CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_CONS_ENTRY );
  1533 		iSize += aSuiteHash.Size() + sizeof(TUint32) + sizeof(TJavaTransferType);
  1710 		iSize += aSuiteHash.Size() + sizeof(TUint32) + sizeof(TJavaTransferType);
       
  1711 		OstTraceFunctionExit0( DUP1_CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_CONS_EXIT );
  1534 		}
  1712 		}
  1535 
  1713 
  1536 	EXPORT_C CSBJavaTransferType::~CSBJavaTransferType()
  1714 	EXPORT_C CSBJavaTransferType::~CSBJavaTransferType()
  1537 	/**
  1715 	/**
  1538 	C++ Destructor
  1716 	C++ Destructor
  1539 	*/
  1717 	*/
  1540 		{
  1718 		{
       
  1719 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_DES_ENTRY );
       
  1720 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_CSBJAVATRANSFERTYPE_DES_EXIT );
  1541 		}
  1721 		}
  1542 
  1722 
  1543 	void CSBJavaTransferType::InitialiseL(TInt& aOffset)
  1723 	void CSBJavaTransferType::InitialiseL(TInt& aOffset)
  1544 	/**
  1724 	/**
  1545 	Initialise all member pointers to data
  1725 	Initialise all member pointers to data
  1546 	
  1726 	
  1547 	@param aOffset The running offset of where the descriptor has been parsed up to
  1727 	@param aOffset The running offset of where the descriptor has been parsed up to
  1548 	*/
  1728 	*/
  1549 		{
  1729 		{
       
  1730 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_INITIALISEL_ENTRY );
  1550 		CSBGenericTransferType::InitialiseL(aOffset);
  1731 		CSBGenericTransferType::InitialiseL(aOffset);
  1551 		
  1732 		
  1552 		iTransferDataTypeOffset = aOffset;
  1733 		iTransferDataTypeOffset = aOffset;
  1553 		TJavaTransferType transType;
  1734 		TJavaTransferType transType;
  1554 		UnpackTypeAdvance(transType, *iDataBuffer, aOffset);
  1735 		UnpackTypeAdvance(transType, *iDataBuffer, aOffset);
  1555 		
  1736 		
  1556 		UnpackTPtrAdvance(iSuiteHash, aOffset);
  1737 		UnpackTPtrAdvance(iSuiteHash, aOffset);
  1557 
  1738 
  1558 		// Increment the size of the data buffer
  1739 		// Increment the size of the data buffer
  1559 		iDataBuffer->Des().SetLength(aOffset);
  1740 		iDataBuffer->Des().SetLength(aOffset);
       
  1741 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_INITIALISEL_EXIT );
  1560 		}
  1742 		}
  1561 
  1743 
  1562 	void CSBJavaTransferType::InitialiseL(TInt& aOffset, const TDesC& aSuiteHash, TDriveNumber aDriveNumber,
  1744 	void CSBJavaTransferType::InitialiseL(TInt& aOffset, const TDesC& aSuiteHash, TDriveNumber aDriveNumber,
  1563 										TJavaTransferType aTransferDataType)
  1745 										TJavaTransferType aTransferDataType)
  1564 	/**
  1746 	/**
  1567 	@param aOffset The running offset of where the descriptor has been parsed up to
  1749 	@param aOffset The running offset of where the descriptor has been parsed up to
  1568 	@param aSuiteHash The Java MIDlet suite hash
  1750 	@param aSuiteHash The Java MIDlet suite hash
  1569 	@param aSuiteVersion The version of the MIDlet suite
  1751 	@param aSuiteVersion The version of the MIDlet suite
  1570 	*/
  1752 	*/
  1571 		{
  1753 		{
       
  1754 		OstTraceFunctionEntry0( DUP1_CSBJAVATRANSFERTYPE_INITIALISEL_ENTRY );
  1572 		TSBDerivedType derivedType = EJavaTransferDerivedType;
  1755 		TSBDerivedType derivedType = EJavaTransferDerivedType;
  1573 		PackType(derivedType, *iDataBuffer, aOffset);
  1756 		PackType(derivedType, *iDataBuffer, aOffset);
  1574 		
  1757 		
  1575 		CSBGenericTransferType::InitialiseL(aOffset);
  1758 		CSBGenericTransferType::InitialiseL(aOffset);
  1576 
  1759 
  1591 		// Make the member TPtr point to it
  1774 		// Make the member TPtr point to it
  1592 		UnpackTPtrAdvance(iSuiteHash, ptrOffset);
  1775 		UnpackTPtrAdvance(iSuiteHash, ptrOffset);
  1593 		
  1776 		
  1594 		// Increment the size of the data buffer
  1777 		// Increment the size of the data buffer
  1595 		iDataBuffer->Des().SetLength(aOffset);
  1778 		iDataBuffer->Des().SetLength(aOffset);
       
  1779 		OstTraceFunctionExit0( DUP1_CSBJAVATRANSFERTYPE_INITIALISEL_EXIT );
  1596 		}
  1780 		}
  1597 
  1781 
  1598 	void CSBJavaTransferType::ConstructL(const TDesC& aSuiteHash, TDriveNumber aDriveNumber,
  1782 	void CSBJavaTransferType::ConstructL(const TDesC& aSuiteHash, TDriveNumber aDriveNumber,
  1599 										TJavaTransferType aTransferDataType)
  1783 										TJavaTransferType aTransferDataType)
  1600 	/**
  1784 	/**
  1603 	@param aJavaId the Java MIDlet suite hash
  1787 	@param aJavaId the Java MIDlet suite hash
  1604 	@param aDriveNumber the drive that contains the data
  1788 	@param aDriveNumber the drive that contains the data
  1605 	@param aTransferDataType the type of the data you wish to transfer
  1789 	@param aTransferDataType the type of the data you wish to transfer
  1606 	*/
  1790 	*/
  1607 		{
  1791 		{
       
  1792 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_CONSTRUCTL_ENTRY );
  1608 		TInt offset = 0;
  1793 		TInt offset = 0;
  1609 
  1794 
  1610 		BaseConstructL();
  1795 		BaseConstructL();
  1611 
  1796 
  1612 		InitialiseL(offset, aSuiteHash, aDriveNumber, aTransferDataType);
  1797 		InitialiseL(offset, aSuiteHash, aDriveNumber, aTransferDataType);
       
  1798 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_CONSTRUCTL_EXIT );
  1613 		}
  1799 		}
  1614 
  1800 
  1615 	void CSBJavaTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1801 	void CSBJavaTransferType::ConstructL(CSBGenericTransferType* aGenericTransferType)
  1616 	/**
  1802 	/**
  1617 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1803 	Symbian 2nd phase constructor. Validates the externalised type, then passes it to the base ConstructL
  1618 
  1804 
  1619 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1805 	@param aGenericTransferType pointer to a CSBGenericTransferType object
  1620 	*/
  1806 	*/
  1621 		{
  1807 		{
       
  1808 		OstTraceFunctionEntry0( DUP1_CSBJAVATRANSFERTYPE_CONSTRUCTL_ENTRY );
  1622 		if (aGenericTransferType == NULL)
  1809 		if (aGenericTransferType == NULL)
  1623 			{
  1810 			{
       
  1811 		    OstTrace0(TRACE_ERROR, CSBJAVATRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1624 			User::Leave(KErrArgument);
  1812 			User::Leave(KErrArgument);
  1625 			}
  1813 			}
  1626 		if (EJavaTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1814 		if (EJavaTransferDerivedType != aGenericTransferType->DerivedTypeL())
  1627 			{
  1815 			{
       
  1816 		    OstTrace0(TRACE_ERROR, DUP1_CSBJAVATRANSFERTYPE_CONSTRUCTL, "Leave: KErrArgument");
  1628 			User::Leave(KErrArgument);
  1817 			User::Leave(KErrArgument);
  1629 			}
  1818 			}
  1630 		// Call the base class ConstructL
  1819 		// Call the base class ConstructL
  1631 		CSBGenericDataType::ConstructL(aGenericTransferType->Externalise());
  1820 		CSBGenericDataType::ConstructL(aGenericTransferType->Externalise());
       
  1821 		OstTraceFunctionExit0( DUP1_CSBJAVATRANSFERTYPE_CONSTRUCTL_EXIT );
  1632 		}
  1822 		}
  1633 		
  1823 		
  1634 	EXPORT_C const TDesC& CSBJavaTransferType::SuiteHashL() const
  1824 	EXPORT_C const TDesC& CSBJavaTransferType::SuiteHashL() const
  1635 	/**
  1825 	/**
  1636 	Getter for the secure identifier
  1826 	Getter for the secure identifier
  1646 	Getter for the transfer data type
  1836 	Getter for the transfer data type
  1647 		
  1837 		
  1648 	@return  The transfer data type
  1838 	@return  The transfer data type
  1649 	*/
  1839 	*/
  1650 		{
  1840 		{
       
  1841 		OstTraceFunctionEntry0( CSBJAVATRANSFERTYPE_DATATYPEL_ENTRY );
  1651 		TJavaTransferType transType;
  1842 		TJavaTransferType transType;
  1652 		
  1843 		
  1653 		UnpackType(transType, *iDataBuffer, iTransferDataTypeOffset);
  1844 		UnpackType(transType, *iDataBuffer, iTransferDataTypeOffset);
  1654 
  1845 
       
  1846 		OstTraceFunctionExit0( CSBJAVATRANSFERTYPE_DATATYPEL_EXIT );
  1655 		return transType;
  1847 		return transType;
  1656 		}
  1848 		}
  1657 		
  1849 		
  1658 		
  1850 		
  1659 		
  1851 		
  1664 	@param aEntry Information about the file that this object will represent
  1856 	@param aEntry Information about the file that this object will represent
  1665 	@param aSession Required to map from TEntry's UID MIME type into a textual representation
  1857 	@param aSession Required to map from TEntry's UID MIME type into a textual representation
  1666 	@return Instance of CSBEFileEntry created from data supplied in aEntry
  1858 	@return Instance of CSBEFileEntry created from data supplied in aEntry
  1667 	*/
  1859 	*/
  1668 		{
  1860 		{
       
  1861 		OstTraceFunctionEntry0( CSBEFILEENTRY_NEWLC_ENTRY );
  1669 		CSBEFileEntry* self = new (ELeave) CSBEFileEntry(aEntry);
  1862 		CSBEFileEntry* self = new (ELeave) CSBEFileEntry(aEntry);
  1670 		CleanupStack::PushL(self);
  1863 		CleanupStack::PushL(self);
  1671 		self->ConstructL(aEntry, aSession);
  1864 		self->ConstructL(aEntry, aSession);
       
  1865 		OstTraceFunctionExit0( CSBEFILEENTRY_NEWLC_EXIT );
  1672 		return self;
  1866 		return self;
  1673 		}
  1867 		}
  1674 		
  1868 		
  1675 	EXPORT_C CSBEFileEntry* CSBEFileEntry::NewLC(const TDesC8& aStream, TInt& aBytesRead)
  1869 	EXPORT_C CSBEFileEntry* CSBEFileEntry::NewLC(const TDesC8& aStream, TInt& aBytesRead)
  1676 	/** Constructor designed to internalise an instance of CSBEFileEntry from a previously 
  1870 	/** Constructor designed to internalise an instance of CSBEFileEntry from a previously 
  1680 						from the descriptor for use in streaming multiple objects from one 
  1874 						from the descriptor for use in streaming multiple objects from one 
  1681 						stream
  1875 						stream
  1682 	@return Instance of CSBEFileEntry containing the information previously packed into aStream
  1876 	@return Instance of CSBEFileEntry containing the information previously packed into aStream
  1683 	*/
  1877 	*/
  1684 		{
  1878 		{
       
  1879 		OstTraceFunctionEntry0( DUP1_CSBEFILEENTRY_NEWLC_ENTRY );
  1685 		CSBEFileEntry* self = new (ELeave) CSBEFileEntry;
  1880 		CSBEFileEntry* self = new (ELeave) CSBEFileEntry;
  1686 		CleanupStack::PushL(self);
  1881 		CleanupStack::PushL(self);
  1687 		self->InternaliseL(aStream, aBytesRead);
  1882 		self->InternaliseL(aStream, aBytesRead);
       
  1883 		OstTraceFunctionExit0( DUP1_CSBEFILEENTRY_NEWLC_EXIT );
  1688 		return self;
  1884 		return self;
  1689 		}
  1885 		}
  1690 		
  1886 		
  1691 	CSBEFileEntry::CSBEFileEntry()
  1887 	CSBEFileEntry::CSBEFileEntry()
  1692 	/** C++ ctor */
  1888 	/** C++ ctor */
  1693 		{
  1889 		{
       
  1890 		OstTraceFunctionEntry0( CSBEFILEENTRY_CSBEFILEENTRY_CONS_ENTRY );
       
  1891 		OstTraceFunctionExit0( CSBEFILEENTRY_CSBEFILEENTRY_CONS_EXIT );
  1694 		}
  1892 		}
  1695 
  1893 
  1696 	CSBEFileEntry::CSBEFileEntry(const TEntry& aEntry)
  1894 	CSBEFileEntry::CSBEFileEntry(const TEntry& aEntry)
  1697 	/** C++ ctor that copies out the parts of aEntry that don't require heap allocation 
  1895 	/** C++ ctor that copies out the parts of aEntry that don't require heap allocation 
  1698 	@param aEntry The entry to copy most of the settings from
  1896 	@param aEntry The entry to copy most of the settings from
  1699 	*/
  1897 	*/
  1700 		: iAtt(aEntry.iAtt), iSize(aEntry.iSize), iModified(aEntry.iModified), iUidType(aEntry.iType)
  1898 		: iAtt(aEntry.iAtt), iSize(aEntry.iSize), iModified(aEntry.iModified), iUidType(aEntry.iType)
  1701 		{
  1899 		{
       
  1900 		OstTraceFunctionEntry0( DUP1_CSBEFILEENTRY_CSBEFILEENTRY_CONS_ENTRY );
       
  1901 		OstTraceFunctionExit0( DUP1_CSBEFILEENTRY_CSBEFILEENTRY_CONS_EXIT );
  1702 		}
  1902 		}
  1703 		
  1903 		
  1704 	EXPORT_C CSBEFileEntry::~CSBEFileEntry()
  1904 	EXPORT_C CSBEFileEntry::~CSBEFileEntry()
  1705 	/** C++ dtor */
  1905 	/** C++ dtor */
  1706 		{
  1906 		{
       
  1907 		OstTraceFunctionEntry0( CSBEFILEENTRY_CSBEFILEENTRY_DES_ENTRY );
  1707 		delete iType;
  1908 		delete iType;
       
  1909 		iType = NULL;
  1708 		delete iFilename;
  1910 		delete iFilename;
       
  1911 		iFilename = NULL;
       
  1912 		OstTraceFunctionExit0( CSBEFILEENTRY_CSBEFILEENTRY_DES_EXIT );
  1709 		}
  1913 		}
  1710 		
  1914 		
  1711 	void CSBEFileEntry::ConstructL(const TEntry& aEntry, RApaLsSession& aSession)
  1915 	void CSBEFileEntry::ConstructL(const TEntry& aEntry, RApaLsSession& aSession)
  1712 	/** Symbian 2nd phase constructor used when instantiating an instance from component parts
  1916 	/** Symbian 2nd phase constructor used when instantiating an instance from component parts
  1713 	rather than from a previously externalised stream
  1917 	rather than from a previously externalised stream
  1714 	@param aEntry Information about the file that this object will represent
  1918 	@param aEntry Information about the file that this object will represent
  1715 	@param aSession Required to map from TEntry's UID MIME type into a textual representation
  1919 	@param aSession Required to map from TEntry's UID MIME type into a textual representation
  1716 	*/
  1920 	*/
  1717 		{
  1921 		{
       
  1922 		OstTraceFunctionEntry0( CSBEFILEENTRY_CONSTRUCTL_ENTRY );
  1718 		// Look up the textual mime type of the file instead of the numerical one given by TEntry
  1923 		// Look up the textual mime type of the file instead of the numerical one given by TEntry
  1719 		TUid uidForType;
  1924 		TUid uidForType;
  1720 		TDataType appDataType;
  1925 		TDataType appDataType;
  1721 		aSession.AppForDocument(aEntry.iName,uidForType,appDataType);
  1926 		aSession.AppForDocument(aEntry.iName,uidForType,appDataType);
  1722 		iType = appDataType.Des().AllocL();
  1927 		iType = appDataType.Des().AllocL();
  1723 		iFilename = aEntry.iName.AllocL();
  1928 		iFilename = aEntry.iName.AllocL();
       
  1929 		OstTraceFunctionExit0( CSBEFILEENTRY_CONSTRUCTL_EXIT );
  1724 		}
  1930 		}
  1725 		
  1931 		
  1726 	void CSBEFileEntry::InternaliseL(const TDesC8& aStream, TInt& aBytesRead)
  1932 	void CSBEFileEntry::InternaliseL(const TDesC8& aStream, TInt& aBytesRead)
  1727 	/** Symbian 2nd phase constructor used when instantiating an instance from a previously 
  1933 	/** Symbian 2nd phase constructor used when instantiating an instance from a previously 
  1728 	externalised stream of bytes. aStream must begin at the beginning of the internalised
  1934 	externalised stream of bytes. aStream must begin at the beginning of the internalised
  1731 	@param aStream The stream containing at least one instance of CSBEFileEntry
  1937 	@param aStream The stream containing at least one instance of CSBEFileEntry
  1732 	@param aBytesRead Upon return, this will contain the number of bytes read from aStream
  1938 	@param aBytesRead Upon return, this will contain the number of bytes read from aStream
  1733 						in order to internalise this single instance of CSBEFileEntry
  1939 						in order to internalise this single instance of CSBEFileEntry
  1734 	*/
  1940 	*/
  1735 		{
  1941 		{
       
  1942 		OstTraceFunctionEntry0( CSBEFILEENTRY_INTERNALISEL_ENTRY );
  1736 		RDesReadStream stream(aStream);
  1943 		RDesReadStream stream(aStream);
  1737 		CleanupClosePushL(stream);
  1944 		CleanupClosePushL(stream);
  1738 		
  1945 		
  1739 		// Unpack the trivial types
  1946 		// Unpack the trivial types
  1740 		iAtt = stream.ReadUint32L();
  1947 		iAtt = stream.ReadUint32L();
  1762 		TPtr filenameBuf(iFilename->Des());
  1969 		TPtr filenameBuf(iFilename->Des());
  1763 		stream.ReadL(filenameBuf, filenameLength);
  1970 		stream.ReadL(filenameBuf, filenameLength);
  1764 		
  1971 		
  1765 		aBytesRead = CalculatePackedSize();
  1972 		aBytesRead = CalculatePackedSize();
  1766 		CleanupStack::PopAndDestroy(&stream);
  1973 		CleanupStack::PopAndDestroy(&stream);
       
  1974 		OstTraceFunctionExit0( CSBEFILEENTRY_INTERNALISEL_EXIT );
  1767 		}
  1975 		}
  1768 		
  1976 		
  1769 	TUint16 CSBEFileEntry::CalculatePackedSize() const
  1977 	TUint16 CSBEFileEntry::CalculatePackedSize() const
  1770 	/** calculate the size of this object when externalised
  1978 	/** calculate the size of this object when externalised
  1771 	@return the size in bytes of the externalised representation of this object
  1979 	@return the size in bytes of the externalised representation of this object
  1772 	*/
  1980 	*/
  1773 		{
  1981 		{
       
  1982 		OstTraceFunctionEntry0( CSBEFILEENTRY_CALCULATEPACKEDSIZE_ENTRY );
  1774 		TInt total = 
  1983 		TInt total = 
  1775 			sizeof(TUint32) +		// Length of attribute field
  1984 			sizeof(TUint32) +		// Length of attribute field
  1776 			sizeof(TInt32) +		// Length of file size
  1985 			sizeof(TInt32) +		// Length of file size
  1777 			8 +	// Length of last modified time
  1986 			8 +	// Length of last modified time
  1778 			sizeof(TUidType) +	// Length of MIME type uids
  1987 			sizeof(TUidType) +	// Length of MIME type uids
  1779 			sizeof(TUint16) + 	// Text MIME type length
  1988 			sizeof(TUint16) + 	// Text MIME type length
  1780 			iType->Size() +		// Text MIME type data
  1989 			iType->Size() +		// Text MIME type data
  1781 			sizeof(TUint16) + 	// Filename length
  1990 			sizeof(TUint16) + 	// Filename length
  1782 			iFilename->Size();	// Filename data
  1991 			iFilename->Size();	// Filename data
       
  1992 		OstTraceFunctionExit0( CSBEFILEENTRY_CALCULATEPACKEDSIZE_EXIT );
  1783 		return total;
  1993 		return total;
  1784 		}
  1994 		}
  1785 
  1995 
  1786 	EXPORT_C HBufC8* CSBEFileEntry::ExternaliseLC() const
  1996 	EXPORT_C HBufC8* CSBEFileEntry::ExternaliseLC() const
  1787 	/** Return a pointer to a buffer descriptor containing an externalised representation of
  1997 	/** Return a pointer to a buffer descriptor containing an externalised representation of
  1788 	the data stored by this object. The returned stream is suitable for unpacking an identical 
  1998 	the data stored by this object. The returned stream is suitable for unpacking an identical 
  1789 	instance of this object by using the NewLC that accepts a descriptor as an argument
  1999 	instance of this object by using the NewLC that accepts a descriptor as an argument
  1790 	@return An externalised instance of this object suitable for Internalising
  2000 	@return An externalised instance of this object suitable for Internalising
  1791 	*/
  2001 	*/
  1792 		{
  2002 		{
       
  2003 		OstTraceFunctionEntry0( CSBEFILEENTRY_EXTERNALISELC_ENTRY );
  1793 		TUint16 packedSize = CalculatePackedSize();
  2004 		TUint16 packedSize = CalculatePackedSize();
  1794 		HBufC8* pBuf = HBufC8::NewLC(packedSize);
  2005 		HBufC8* pBuf = HBufC8::NewLC(packedSize);
  1795 		TPtr8 buf(pBuf->Des());
  2006 		TPtr8 buf(pBuf->Des());
  1796 		RDesWriteStream stream(buf);
  2007 		RDesWriteStream stream(buf);
  1797 		CleanupClosePushL(stream);
  2008 		CleanupClosePushL(stream);
  1807 		stream.WriteL(*iType);
  2018 		stream.WriteL(*iType);
  1808 		stream.WriteUint16L(iFilename->Length());
  2019 		stream.WriteUint16L(iFilename->Length());
  1809 		stream.WriteL(*iFilename);
  2020 		stream.WriteL(*iFilename);
  1810 		
  2021 		
  1811 		CleanupStack::PopAndDestroy(&stream);
  2022 		CleanupStack::PopAndDestroy(&stream);
       
  2023 		OstTraceFunctionExit0( CSBEFILEENTRY_EXTERNALISELC_EXIT );
  1812 		return pBuf;
  2024 		return pBuf;
  1813 		}
  2025 		}
  1814 		
  2026 		
  1815 	EXPORT_C TUint CSBEFileEntry::FileAttributes() const
  2027 	EXPORT_C TUint CSBEFileEntry::FileAttributes() const
  1816 	/** Accessor function returning the packed bitmask representing the attributes
  2028 	/** Accessor function returning the packed bitmask representing the attributes