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