epoc32/include/gsmustor.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// Declares the classes TSAREntry and CSARStore
williamr@2
    15
// Abbreviations:
williamr@2
    16
// PDU - Packet Data Unit
williamr@2
    17
// SAR - Segmentation and Reassembly Store
williamr@2
    18
// SR  - Status Report
williamr@2
    19
// 
williamr@2
    20
//
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
/**
williamr@2
    25
 @file
williamr@2
    26
*/
williamr@2
    27
williamr@2
    28
#ifndef GSMUSTOR_H__
williamr@2
    29
#define GSMUSTOR_H__
williamr@2
    30
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <s32std.h>
williamr@2
    33
#include <s32file.h>
williamr@2
    34
#include <gsmumsg.h>
williamr@2
    35
#include <babackup.h>
williamr@2
    36
williamr@2
    37
/**
williamr@2
    38
 *  Filestore second UID for SAR stores.
williamr@2
    39
 *  @publishedAll
williamr@2
    40
 *  @released
williamr@2
    41
 */
williamr@2
    42
const TUid KSARStoreUid={0x1000089d};
williamr@2
    43
williamr@2
    44
//
williamr@2
    45
// forward declarations
williamr@2
    46
//
williamr@2
    47
class RReadStream;
williamr@2
    48
class RWriteStream;
williamr@2
    49
williamr@2
    50
/**
williamr@2
    51
 *  Provides generic information useful for the segmentation and reassembly of
williamr@2
    52
 *  SMS messages and reassembly of WAP datagrams.
williamr@2
    53
 *  
williamr@2
    54
 *  The constituent parts of both concatenated SMS messages and concatenated 7-bit
williamr@2
    55
 *  WAP datagrams contain a reference, the total number of parts and the index
williamr@2
    56
 *  of the part in the complete message or datagram.
williamr@2
    57
 *  
williamr@2
    58
 *  Field for the segmentation store are:
williamr@2
    59
 *  
williamr@2
    60
 *  Reference - concatenation reference
williamr@2
    61
 *  Total - total number of PDUs in SMS message
williamr@2
    62
 *  Count - number of PDUs sent
williamr@2
    63
 *  Data1 - total PDUs delivered<<16 and failed
williamr@2
    64
 *  Data2 - log server id
williamr@2
    65
 *  Data3 - validity period
williamr@2
    66
 *  Data4 - type and min and max message reference
williamr@2
    67
 *  Description1 - first 32 characters from buffer
williamr@2
    68
 *  Description2 - original address
williamr@2
    69
 *  Time - time on SMS message
williamr@2
    70
 *  
williamr@2
    71
 *  Abstracts an entry which is stored in the CSARStore
williamr@2
    72
 *  
williamr@2
    73
 *  The data stored in Data1-4 has a different meaning depending on if it is used
williamr@2
    74
 *  by the Reassembly store or the Segmentation store. The lists below detail
williamr@2
    75
 *  the uses:
williamr@2
    76
 *  
williamr@2
    77
 *  Reassembly store:
williamr@2
    78
 *  
williamr@2
    79
 *  Data1: byte 3: bits7to4; byte 1: identifier1; byte 0: identifier2.
williamr@2
    80
 *  
williamr@2
    81
 *  Data2: Log server ID.
williamr@2
    82
 *  
williamr@2
    83
 *  Data3: byte 0: PDU type.
williamr@2
    84
 *  
williamr@2
    85
 *  Data4: SMS message storage .
williamr@2
    86
 *  
williamr@2
    87
 *  Segmentation store:
williamr@2
    88
 *  
williamr@2
    89
 *  Data1: bytes 3, 2: N delivered; byte 1,0 N failed.
williamr@2
    90
 *  
williamr@2
    91
 *  Data2: Log server ID.
williamr@2
    92
 *  
williamr@2
    93
 *  Data3: SMS submit validity period.
williamr@2
    94
 *  
williamr@2
    95
 *  Data4: byte 3,2 message PDU type; byte 1: reference1; byte 0: reference2.
williamr@2
    96
 *  
williamr@2
    97
 *  WAP reassembly store:
williamr@2
    98
 *  
williamr@2
    99
 *  Data1: to port.
williamr@2
   100
 *  
williamr@2
   101
 *  Data2: not used .
williamr@2
   102
 *  
williamr@2
   103
 *  Data3: not used.
williamr@2
   104
 *  
williamr@2
   105
 *  Data4: not used.
williamr@2
   106
 *  
williamr@2
   107
 *  <pre>
williamr@2
   108
 *  
williamr@2
   109
 *  The data stored in Data1-4 has a different meaning depending on if it is used
williamr@2
   110
 *  by the Reassembly store or the Segmentation store. The tables below detail
williamr@2
   111
 *  the uses:
williamr@2
   112
 *  
williamr@2
   113
 *  Reassembly Store:
williamr@2
   114
 *  
williamr@2
   115
 *  -----------------------------------------------------------------
williamr@2
   116
 *  |  member |    3      |      2      |      1      |      0      |
williamr@2
   117
 *  -----------------------------------------------------------------
williamr@2
   118
 *  | iData1  |    bits7to4             | identifier1 | identifier2 |
williamr@2
   119
 *  | iData2  |                   Log server ID                     |
williamr@2
   120
 *  | iData3  |                                       | PDU type    |
williamr@2
   121
 *  | iData4  |                 SMS message storage                 |
williamr@2
   122
 *  -----------------------------------------------------------------
williamr@2
   123
 *  
williamr@2
   124
 *  Segmentation Store:
williamr@2
   125
 *  
williamr@2
   126
 *  -----------------------------------------------------------------
williamr@2
   127
 *  |  member |    3      |      2      |      1      |      0      |
williamr@2
   128
 *  -----------------------------------------------------------------
williamr@2
   129
 *  | iData1  |    N delivered          |         N failed          |
williamr@2
   130
 *  | iData2  |                   Log server ID                     |
williamr@2
   131
 *  | iData3  |              SMS submit validity period             |
williamr@2
   132
 *  | iData4  |   message PDU type      | reference1  | reference2  |
williamr@2
   133
 *  -----------------------------------------------------------------
williamr@2
   134
 *  
williamr@2
   135
 *  WAP Reassembly Store:
williamr@2
   136
 *  
williamr@2
   137
 *  -----------------------------------------------------------------
williamr@2
   138
 *  |  member |    3      |      2      |      1      |      0      |
williamr@2
   139
 *  -----------------------------------------------------------------
williamr@2
   140
 *  | iData1  |                    to port                          |
williamr@2
   141
 *  | iData2  |                   not used                          |
williamr@2
   142
 *  | iData3  |                   not used                          |
williamr@2
   143
 *  | iData4  |                   not used                          |
williamr@2
   144
 *  -----------------------------------------------------------------
williamr@2
   145
 *  
williamr@2
   146
 *  </pre>
williamr@2
   147
 *  
williamr@2
   148
 *  @publishedAll
williamr@2
   149
 *  @released 
williamr@2
   150
 *
williamr@2
   151
 */
williamr@2
   152
class TSAREntry
williamr@2
   153
	{
williamr@2
   154
public:
williamr@2
   155
	enum
williamr@2
   156
		{
williamr@2
   157
		ESmsSAREntryDescriptionLength=32
williamr@2
   158
		};
williamr@2
   159
public:
williamr@2
   160
	IMPORT_C TSAREntry();
williamr@2
   161
	inline TInt Reference() const;
williamr@2
   162
	inline void SetReference(TInt aReference);
williamr@2
   163
	inline TInt Total() const;
williamr@2
   164
	inline void SetTotal(TInt aTotal);
williamr@2
   165
	inline TInt Count() const;
williamr@2
   166
	inline void SetCount(TInt aCount);
williamr@2
   167
	inline TBool IsComplete() const;
williamr@2
   168
williamr@2
   169
	/**
williamr@2
   170
	 *  Gets the Log server ID field.
williamr@2
   171
	 *  
williamr@2
   172
	 *  	@return Log server ID field 
williamr@2
   173
	 */
williamr@2
   174
	inline TInt LogServerId() const {return iData2;}
williamr@2
   175
	/**
williamr@2
   176
	 *  Sets the Log server ID field.
williamr@2
   177
	 *  
williamr@2
   178
	 *  	@param aId Log server ID field 
williamr@2
   179
	 */
williamr@2
   180
	inline void SetLogServerId(TInt aId) {iData2 = aId;}
williamr@2
   181
williamr@2
   182
	inline TPtrC Description1() const;
williamr@2
   183
	inline void SetDescription1(const TDesC& aDescription);
williamr@2
   184
	inline TPtrC Description2() const;
williamr@2
   185
	inline void SetDescription2(const TDesC& aDescription);
williamr@2
   186
williamr@2
   187
	inline TInt Data3() const;
williamr@2
   188
	inline void SetData3(TInt aData);
williamr@2
   189
williamr@2
   190
	inline const TTime& Time() const;
williamr@2
   191
	inline void SetTime(const TTime& aTime);
williamr@2
   192
williamr@2
   193
	inline TStreamId DataStreamId() const;
williamr@2
   194
	inline void SetDataStreamId(TStreamId aStreamId);
williamr@2
   195
williamr@2
   196
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   197
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   198
williamr@2
   199
private:
williamr@2
   200
	inline TBool IsDeleted() const;
williamr@2
   201
	inline void SetIsDeleted(TBool aIsDeleted);
williamr@2
   202
	inline TBool IsAdded() const;
williamr@2
   203
	inline void SetIsAdded(TBool aIsAdded);
williamr@2
   204
williamr@2
   205
private:
williamr@2
   206
	enum TSAREntryFlags
williamr@2
   207
		{
williamr@2
   208
		ESAREntryIsDeleted=0x01, ///< indicates that this entry is deleted
williamr@2
   209
		ESAREntryIsAdded=0x02    ///< indicated that this entry is added
williamr@2
   210
		};
williamr@2
   211
private:
williamr@2
   212
	TInt iReference; ///< concatenation reference
williamr@2
   213
	TInt iTotal;     ///< total number of PDUs in this SMS message
williamr@2
   214
	TInt iCount;     ///< number of PDUs sent/received for this SMS message
williamr@2
   215
protected:
williamr@2
   216
	TInt iData1;     /// TODO should be TUint32
williamr@2
   217
	TInt iData2;     ///< Log server ID
williamr@2
   218
	TInt iData3;
williamr@2
   219
	TInt iData4;
williamr@2
   220
private:
williamr@2
   221
	TBuf<ESmsSAREntryDescriptionLength> iDescription1; ///< first 32 characters from buffer
williamr@2
   222
	TBuf<ESmsSAREntryDescriptionLength> iDescription2; ///< original address
williamr@2
   223
	TTime iTime;                                       ///< time when message was sent/received
williamr@2
   224
	TStreamId iDataStreamId;
williamr@2
   225
	TInt iFlags;  //  Not externalized
williamr@2
   226
	friend class CSARStore;
williamr@2
   227
	friend class CSmsPermanentFileStore;
williamr@2
   228
	friend class CPreallocatedFile;
williamr@2
   229
	};
williamr@2
   230
williamr@2
   231
williamr@2
   232
/**
williamr@2
   233
 *  Abstraction of an SMS reassembly store entry for incoming SMS messages.
williamr@2
   234
 *  
williamr@2
   235
 *  This class should reflect parts of a complete SMS message to be stored in
williamr@2
   236
 *  the reassembly store.
williamr@2
   237
 *  @publishedAll
williamr@2
   238
 *  @released 
williamr@2
   239
 */
williamr@2
   240
class TSmsReassemblyEntry : public TSAREntry
williamr@2
   241
	{
williamr@2
   242
private:
williamr@2
   243
	enum
williamr@2
   244
		{
williamr@2
   245
		KMarkedAsPassedToClientFlag = 0x80000000,
williamr@2
   246
		KPduTypeMask = 0xFF,
williamr@2
   247
		KReassemblyEntryClear = 0x00
williamr@2
   248
		};
williamr@2
   249
williamr@2
   250
public:
williamr@2
   251
	// iData1
williamr@2
   252
	/**
williamr@2
   253
	 *  Gets bits 7 to 4 from Data1 field.
williamr@2
   254
	 *  
williamr@2
   255
	 *  	@return Bits 7 to 4 of Data 1 
williamr@2
   256
	 */
williamr@2
   257
	inline TInt Bits7to4() const {return (iData1 >> 16) & 0xffff;}
williamr@2
   258
	/**
williamr@2
   259
	 *  Gets Identifier1 from Data1 field.
williamr@2
   260
	 *  
williamr@2
   261
	 *  	@return Identifier1 
williamr@2
   262
	 */
williamr@2
   263
	inline TInt Identifier1() const {return (iData1 >> 8) & 0xff;}
williamr@2
   264
	/**
williamr@2
   265
	 *  Gets Identifier2 from Data1 field.
williamr@2
   266
	 *  
williamr@2
   267
	 *  	@return Identifier2 
williamr@2
   268
	 */
williamr@2
   269
	inline TInt Identifier2() const {return (iData1 >> 0) & 0xff;}
williamr@2
   270
	inline void SetBits7to4andIdentifiers(TInt aBits7to4, TInt aId1, TInt aId2)
williamr@2
   271
	/**
williamr@2
   272
	 *  Sets bits 7 to 4, Identifier1, and Identifier2, in Data1 field.
williamr@2
   273
	 *  
williamr@2
   274
	 *  @param aBits7to4 Bits 7 to 4
williamr@2
   275
	 *  @param aId1 Identifier1
williamr@2
   276
	 *  	@param aId2 Identifier2 
williamr@2
   277
	 */
williamr@2
   278
	{iData1 = (TInt)((aBits7to4 << 16) | ((aId1 & 0xff)<< 8) | (aId2 & 0xff)); }
williamr@2
   279
williamr@2
   280
	// iData3
williamr@2
   281
	/**
williamr@2
   282
	 *  Gets PDU type.
williamr@2
   283
	 *  
williamr@2
   284
	 *  	@return PDU type 
williamr@2
   285
	 */
williamr@2
   286
	inline CSmsPDU::TSmsPDUType PduType() const {return (CSmsPDU::TSmsPDUType)(iData3 & 0xff);} // 8 bits
williamr@2
   287
	/**
williamr@2
   288
	 *  Sets PDU type.
williamr@2
   289
	 *  
williamr@2
   290
	 *  	@param aPduType PDU type 
williamr@2
   291
	 */
williamr@2
   292
	inline void SetPduType(CSmsPDU::TSmsPDUType aPduType) {iData3 = (iData3 & ~KPduTypeMask) | (TInt)(aPduType & KPduTypeMask);}
williamr@2
   293
williamr@2
   294
	/**
williamr@2
   295
	 *  Tests if Passed To Client flag is set.
williamr@2
   296
	 *  
williamr@2
   297
	 *  	@return True if Passed To Client flag is set. 
williamr@2
   298
	 */
williamr@2
   299
	inline TBool PassedToClient() const {return (iData3 & KMarkedAsPassedToClientFlag) ? ETrue:EFalse;}
williamr@2
   300
	/**
williamr@2
   301
	 *  Sets Passed To Client flag.
williamr@2
   302
	 *  
williamr@2
   303
	 *  	@param aPassed True if Passed To Client flag is set. 
williamr@2
   304
	 */
williamr@2
   305
	inline void SetPassedToClient(TBool aPassed) {iData3 = (iData3 & ~KMarkedAsPassedToClientFlag) | (aPassed ? KMarkedAsPassedToClientFlag : KReassemblyEntryClear);}
williamr@2
   306
williamr@2
   307
	// iData4
williamr@2
   308
	/**
williamr@2
   309
	 *  Gets storage information.
williamr@2
   310
	 *  
williamr@2
   311
	 *  	@return Storage information 
williamr@2
   312
	 */
williamr@2
   313
	inline CSmsMessage::TMobileSmsStorage Storage() const {return (CSmsMessage::TMobileSmsStorage)(iData4 & 0xff);}
williamr@2
   314
	/**
williamr@2
   315
	 *  Sets storage information.
williamr@2
   316
	 *  
williamr@2
   317
	 *  	@param aStorage Storage information 
williamr@2
   318
	 */
williamr@2
   319
	inline void SetStorage(CSmsMessage::TMobileSmsStorage aStorage) {iData4 = (CSmsMessage::TMobileSmsStorage)aStorage;}
williamr@2
   320
	};
williamr@2
   321
williamr@2
   322
williamr@2
   323
/**
williamr@2
   324
 *  Abstraction of an SMS segmentation store entry for outgoing SMS messages.
williamr@2
   325
 *  
williamr@2
   326
 *  This class should reflect parts of a complete SMS message to be stored in
williamr@2
   327
 *  the segmentation store.
williamr@2
   328
 *  @publishedAll
williamr@2
   329
 *  @released 
williamr@2
   330
 */
williamr@2
   331
class TSmsSegmentationEntry : public TSAREntry
williamr@2
   332
	{
williamr@2
   333
public:
williamr@2
   334
	// iData1
williamr@2
   335
	/**
williamr@2
   336
	 *  Gets number of delivered PDUs.
williamr@2
   337
	 *  
williamr@2
   338
	 *  	@return Number of delivered PDUs 
williamr@2
   339
	 */
williamr@2
   340
	inline TInt Delivered() const {return (iData1 >> 16);}
williamr@2
   341
	/**
williamr@2
   342
	 *  Gets number of permanently failed PDUs.
williamr@2
   343
	 *  
williamr@2
   344
	 *  	@return Number of permanently failed PDUs 
williamr@2
   345
	 */
williamr@2
   346
	inline TInt Failed() const {return (iData1 & 0xffff);}
williamr@2
   347
	inline void SetDeliveredAndFailed(TInt aDelivered, TInt aFailed)
williamr@2
   348
	/**
williamr@2
   349
	 *  Sets the number of delivered and failed PDUs.
williamr@2
   350
	 *  
williamr@2
   351
	 *  @param aDelivered Number of delivered PDUs
williamr@2
   352
	 *  	@param aFailed Number of permanently failed PDUs 
williamr@2
   353
	 */
williamr@2
   354
		{iData1 = ((aDelivered << 16) | (aFailed & 0xffff));}
williamr@2
   355
williamr@2
   356
	// iData3
williamr@2
   357
	/**
williamr@2
   358
	 *  Gets the Validity Period.
williamr@2
   359
	 *  
williamr@2
   360
	 *  	@return Validity Period 
williamr@2
   361
	 */
williamr@2
   362
	inline TInt ValidityPeriod() const {return (iData3); }
williamr@2
   363
	/**
williamr@2
   364
	 *  Sets the Validity Period.
williamr@2
   365
	 *  
williamr@2
   366
	 *  	@param aValPer Validity Period 
williamr@2
   367
	 */
williamr@2
   368
	inline void SetValidityPeriod(TInt aValPer) {iData3 = aValPer; }
williamr@2
   369
williamr@2
   370
	// iData4
williamr@2
   371
	/**
williamr@2
   372
	 *  Tests if a status report is expected.
williamr@2
   373
	 *  
williamr@2
   374
	 *  	@return True if a status report is expected 
williamr@2
   375
	 */
williamr@2
   376
	inline TBool ExpectStatusReport() const {return (((iData4 >> 24) & 0x01) == 0x01); }
williamr@2
   377
	/**
williamr@2
   378
	 *  Gets the type of the PDU.
williamr@2
   379
	 *  
williamr@2
   380
	 *  	@return Type of the PDU 
williamr@2
   381
	 */
williamr@2
   382
	inline CSmsPDU::TSmsPDUType PduType() const {return (CSmsPDU::TSmsPDUType)((iData4 >> 16) & 0xff); }
williamr@2
   383
	/**
williamr@2
   384
	 *  Gets the message reference (low byte).
williamr@2
   385
	 *  
williamr@2
   386
	 *  	@return Message reference (low byte) 
williamr@2
   387
	 */
williamr@2
   388
	inline TInt Reference1() const {return ((iData4 >> 8) & 0xff); }
williamr@2
   389
	/**
williamr@2
   390
	 *  Gets the message reference (high byte).
williamr@2
   391
	 *  
williamr@2
   392
	 *  	@return Message reference (high byte) 
williamr@2
   393
	 */
williamr@2
   394
	inline TInt Reference2() const {return ((iData4 >> 0) & 0xff); }
williamr@2
   395
	inline void SetPduTypeAndRefs(TBool aSR, TInt aPduType, TInt aRef1, TInt aRef2)
williamr@2
   396
	/**
williamr@2
   397
	 *  Sets status report flag, PDU type, and message references.
williamr@2
   398
	 *  
williamr@2
   399
	 *  @param aSR True if a status report is expected
williamr@2
   400
	 *  @param aPduType Type of the PDU
williamr@2
   401
	 *  @param aRef1 Message reference (low byte)
williamr@2
   402
	 *  	@param aRef2 Message reference (high byte) 
williamr@2
   403
	 */
williamr@2
   404
		{iData4 = (((aSR & 0x01) << 24) | (aPduType << 16) | ((aRef1 & 0xff ) << 8) | (aRef2 & 0xff));}
williamr@2
   405
	};
williamr@2
   406
williamr@2
   407
williamr@2
   408
/**
williamr@2
   409
 *  Abstraction of a WAP reassembly store entry.
williamr@2
   410
 *  This class should reflect a complete WAP message.
williamr@2
   411
 *  @publishedAll
williamr@2
   412
 *  @released
williamr@2
   413
 */
williamr@2
   414
class TWapReassemblyEntry : public TSAREntry
williamr@2
   415
	{
williamr@2
   416
public:
williamr@2
   417
	/**
williamr@2
   418
	 *  Gets the destination port number.
williamr@2
   419
	 *  
williamr@2
   420
	 *  	@return Destination port number 
williamr@2
   421
	 */
williamr@2
   422
	inline TInt ToPort() const {return iData1;}
williamr@2
   423
	/**
williamr@2
   424
	 *  Sets the destination port number.
williamr@2
   425
	 *  
williamr@2
   426
	 *  	@param aToPort Destination port number 
williamr@2
   427
	 */
williamr@2
   428
	inline void SetToPort(TInt aToPort){iData1 = aToPort;}
williamr@2
   429
	};
williamr@2
   430
williamr@2
   431
/**
williamr@2
   432
 *  Controls the segmentation and reassembly (SAR) store, used for SMS segmentation
williamr@2
   433
 *  and reassembly, and WAP reassembly.
williamr@2
   434
 *  @publishedAll
williamr@2
   435
 *  @released 
williamr@2
   436
 */
williamr@2
   437
class CSARStore : public CBase
williamr@2
   438
	{
williamr@2
   439
public:
williamr@2
   440
	IMPORT_C void OpenL(const TDesC& aFullName,const TUid& aThirdUid);
williamr@2
   441
	IMPORT_C void Close();
williamr@2
   442
	IMPORT_C void CompactL();
williamr@2
   443
williamr@2
   444
	IMPORT_C const CArrayFix<TSAREntry>& Entries() const;
williamr@2
   445
	IMPORT_C void PurgeL(const TTimeIntervalMinutes& aTimeIntervalMinutes,TBool aPurgeIncompleteOnly);
williamr@2
   446
	IMPORT_C void PurgeL(TInt aKSegmentationLifetimeMultiplier,TBool aPurgeIncompleteOnly);
williamr@2
   447
	IMPORT_C void DeleteEntryL(TInt aIndex);
williamr@2
   448
williamr@2
   449
	IMPORT_C void BeginTransactionLC();
williamr@2
   450
	IMPORT_C void CommitTransactionL(); //Pops this off this cleanup stack and commits iFileStore
williamr@2
   451
	void Revert();
williamr@2
   452
williamr@2
   453
	inline RFs& FileSession() const;
williamr@2
   454
	inline TBool InTransaction()const;
williamr@2
   455
	IMPORT_C void DoOpenL();
williamr@2
   456
	IMPORT_C void PrivatePath(TDes& aPath);
williamr@2
   457
williamr@2
   458
williamr@2
   459
protected:
williamr@2
   460
	IMPORT_C CSARStore(RFs& aFs);
williamr@2
   461
	IMPORT_C ~CSARStore();
williamr@2
   462
williamr@2
   463
	IMPORT_C CFileStore& FileStore();
williamr@2
   464
	IMPORT_C const CFileStore& FileStore() const;
williamr@2
   465
williamr@2
   466
	IMPORT_C void AddEntryL(const TSAREntry& aEntry);
williamr@2
   467
	IMPORT_C void ChangeEntryL(TInt aIndex,const TSAREntry& aNewEntry);
williamr@2
   468
williamr@2
   469
	IMPORT_C TStreamId ExtraStreamId() const;
williamr@2
   470
	IMPORT_C void SetExtraStreamIdL(const TStreamId& aExtraStreamId);
williamr@2
   471
williamr@2
   472
private:
williamr@2
   473
	void DoDeleteEntryL(TInt aIndex);  //  Deletes stream but doesn't call iFileStore->CommitL()
williamr@2
   474
	void InternalizeEntryArrayL();
williamr@2
   475
	void ExternalizeEntryArrayL();
williamr@2
   476
	void DoCommitAndCompactL();
williamr@2
   477
	void RemoveDeletedEntries();
williamr@2
   478
	void ReinstateDeletedEntries();
williamr@2
   479
williamr@2
   480
private:
williamr@2
   481
	enum
williamr@2
   482
		{
williamr@2
   483
		KNumStoreCommitsBeforeCompaction=16
williamr@2
   484
		};
williamr@2
   485
williamr@2
   486
protected:
williamr@2
   487
	RFs& iFs;                             ///< File server handle.
williamr@2
   488
private:
williamr@2
   489
williamr@2
   490
	CFileStore* iFileStore;               ///< pointer to the file store
williamr@2
   491
	CArrayFixFlat<TSAREntry> iEntryArray; ///< array of SAR entries
williamr@2
   492
	TStreamId iExtraStreamId;             ///< used for any other data that needs persisting
williamr@2
   493
	TInt iCommitCount;                    ///< counts number of Commit's - used for CompactL
williamr@2
   494
	TPtrC iFullName;                      ///< holds the name of the File Store
williamr@2
   495
	TUid iThirdUid;
williamr@2
   496
	TBool iInTransaction;					///< For debugging purposes to ensure only one transaction at a time
williamr@2
   497
	};
williamr@2
   498
williamr@2
   499
/**
williamr@2
   500
 *  Closes all SAR stores if a backup event starts.
williamr@2
   501
 *  
williamr@2
   502
 *  This is internal and not intended for use.
williamr@2
   503
 *  @publishedAll
williamr@2
   504
 *  @released 
williamr@2
   505
 */
williamr@2
   506
class CGsmuBackupObserver : public CBase, MBackupOperationObserver
williamr@2
   507
	{
williamr@2
   508
	public:
williamr@2
   509
		IMPORT_C static CGsmuBackupObserver* NewL();
williamr@2
   510
		IMPORT_C ~CGsmuBackupObserver();
williamr@2
   511
		IMPORT_C void AddSARStoreL(CSARStore& aSARStore);
williamr@2
   512
		IMPORT_C void RemoveSARStore(const CSARStore& aSARStore);
williamr@2
   513
williamr@2
   514
	private:
williamr@2
   515
		CGsmuBackupObserver();
williamr@2
   516
		void ConstructL();
williamr@2
   517
		void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes);
williamr@2
   518
williamr@2
   519
		CBaBackupSessionWrapper* iBackup;
williamr@2
   520
		RPointerArray<CSARStore> iSARStores;
williamr@2
   521
	};
williamr@2
   522
williamr@2
   523
#include "gsmustor.inl"
williamr@2
   524
williamr@2
   525
#endif // !defined GSMUSTOR_H__