CSARStore Class Reference

class CSARStore : public CBase

Controls the segmentation and reassembly (SAR) store, used for SMS segmentation and reassembly, and WAP reassembly.

Inherits from

Public Member Functions
IMPORT_C void BeginTransactionLC ()
IMPORT_C void Close ()
IMPORT_C void CommitTransactionL ()
IMPORT_C void CompactL ()
IMPORT_C void DeleteEntryL ( TInt )
IMPORT_C void DoOpenL ()
IMPORT_C const CArrayFix < TSAREntry > & Entries ()
RFs & FileSession ()
TBool InTransaction ()
IMPORT_C void OpenL (const TDesC &, const TUid &)
IMPORT_C void PrivatePath ( TDes &)
IMPORT_C void PurgeL (const TTimeIntervalMinutes &, TBool )
IMPORT_C void PurgeL ( TInt , TBool )
void Revert ()
Protected Member Functions
CSARStore ( RFs &)
~CSARStore ()
IMPORT_C void AddEntryL (const TSAREntry &)
IMPORT_C void ChangeEntryL ( TInt , const TSAREntry &)
IMPORT_C TStreamId ExtraStreamId ()
IMPORT_C CFileStore & FileStore ()
IMPORT_C const CFileStore & FileStore ()
IMPORT_C void SetExtraStreamIdL (const TStreamId &)
Private Member Functions
void DoCommitAndCompactL ()
void DoDeleteEntryL ( TInt )
void ExternalizeEntryArrayL ()
void InternalizeEntryArrayL ()
void ReinstateDeletedEntries ()
void RemoveDeletedEntries ()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum anonymous { KNumStoreCommitsBeforeCompaction  = 16 }
Protected Attributes
RFs & iFs
TInt iMaxmumNumberOfMessagesInSegmentationStore
Private Attributes
TInt iCommitCount
CArrayFixSeg < TSAREntry > iEntryArray
TStreamId iExtraStreamId
CFileStore * iFileStore
TPtrC iFullName
TBool iInTransaction
TUid iThirdUid

Constructor & Destructor Documentation

CSARStore(RFs &)

IMPORT_C CSARStore ( RFs & aFs ) [protected]

Constructor, initialises class members only.

capability
None

Parameters

RFs & aFs File system handle

~CSARStore()

IMPORT_C ~CSARStore ( ) [protected]
Destructor. Frees resource.
capability
None

Member Functions Documentation

AddEntryL(const TSAREntry &)

IMPORT_C void AddEntryL ( const TSAREntry & aEntry ) [protected]

Adds a new entry to the file store.

The function appends the new entry to the internal entry array, and then externalises it.

The file store must be open before calling this function.

capability
None

Parameters

const TSAREntry & aEntry SAR entry to add

BeginTransactionLC()

IMPORT_C void BeginTransactionLC ( )

Sets the SAR store as in-transaction.

The function checks the validity of the call and leaves KErrAccessDenied if invalid.
capability
None

ChangeEntryL(TInt, const TSAREntry &)

IMPORT_C void ChangeEntryL ( TInt aIndex,
const TSAREntry & aNewEntry
) [protected]

Changes an entry in the file store - changes it first in the internal entry array, and then externalizes it.

The file store must be open before calling this function.

capability
None

Parameters

TInt aIndex The index into the SAR store to be changed
const TSAREntry & aNewEntry The new SAR store entry

Close()

IMPORT_C void Close ( )

Closes the file store.

The function deletes the file store object and resets the entry array. It should be called once when the protocol module is closing down.
capability
None

CommitTransactionL()

IMPORT_C void CommitTransactionL ( )
Commits a transaction to the filestore.
capability
None

CompactL()

IMPORT_C void CompactL ( )

Compacts the file store.

This is done on every reboot and for every eighth SMS message sent, to keep the size of the file as low as possible.

This function opens and closes the file automatically.
capability
None

DeleteEntryL(TInt)

IMPORT_C void DeleteEntryL ( TInt aIndex )

Deletes an entry from the entry array, and externalizes it.

The file store must be open before calling this function.

capability
None

Parameters

TInt aIndex Entry in the SAR store to delete

DoCommitAndCompactL()

void DoCommitAndCompactL ( ) [private]

called by CloseFile - always do a CommitL and if the store is of a certains size then call CompactL also

DoDeleteEntryL(TInt)

void DoDeleteEntryL ( TInt aIndex ) [private]

Actually delete an entry in the entry array

Parameters

TInt aIndex

DoOpenL()

IMPORT_C void DoOpenL ( )

Opens a filestore.

This is called by OpenL() , and does the work of really opening the file. If the file is not there, it creates a new one.
capability
None

Entries()

IMPORT_C const CArrayFix < TSAREntry > & Entries ( ) const

Gets a const reference to the entry array.

capability
None

ExternalizeEntryArrayL()

void ExternalizeEntryArrayL ( ) [private]

externalize - read from RAM to the file store

ExtraStreamId()

IMPORT_C TStreamId ExtraStreamId ( ) const [protected]

Gets the extra stream ID.

capability
None

FileSession()

RFs & FileSession ( ) const [inline]

Gets the file server handle.

FileStore()

IMPORT_C CFileStore & FileStore ( ) [protected]

Gets a reference to the filestore.

capability
None

FileStore()

IMPORT_C const CFileStore & FileStore ( ) const [protected]

Gets a (const) reference to the filestore.

capability
None

InTransaction()

TBool InTransaction ( ) const [inline]

InternalizeEntryArrayL()

void InternalizeEntryArrayL ( ) [private]

internalize - read from the file store into RAM

OpenL(const TDesC &, const TUid &)

IMPORT_C void OpenL ( const TDesC & aFullName,
const TUid & aThirdUid
)

Opens a specified SAR store.

A SAR filestore has has three uids, KPermanentFileStoreLayoutUid, KSARStoreUid (which designates that the file store is a SAR store) and a third UID, that identifies the particular implementation of CSARStore .

capability
None

Parameters

const TDesC & aFullName Name for the segmentation and reassembly filestore
const TUid & aThirdUid Third UID for the filestore.

PrivatePath(TDes &)

IMPORT_C void PrivatePath ( TDes & aPath )

Returns the private path used to open a store.

capability
None

Parameters

TDes & aPath The private path of a store.

PurgeL(const TTimeIntervalMinutes &, TBool)

IMPORT_C void PurgeL ( const TTimeIntervalMinutes & aTimeIntervalMinutes,
TBool aPurgeIncompleteOnly
)

Purges the reassembly file store.

After a multipart message, it delete all the old entries.

Entries will be purged when: 1) The complete message is received; 2) After aTimerintervalMinutes, if aPurgeIncompletely is false.

PurgeL() will be called after the booting of the device or when a message has been received.

This function opens and closes the file automatically.

Note: overload function for segmentation store.

capability
None

Parameters

const TTimeIntervalMinutes & aTimeIntervalMinutes Purge time
TBool aPurgeIncompleteOnly Purge complete messages flag

PurgeL(TInt, TBool)

IMPORT_C void PurgeL ( TInt aKSegmentationLifetimeMultiplier,
TBool aPurgeIncompleteOnly
)

Purges the segmentation store.

This purges the filestore after a multipart message, deleting all the old entries.

This function opens and closes the file automatically.

capability
None

Parameters

TInt aKSegmentationLifetimeMultiplier The coefficient for calculating whether a message should be purged
TBool aPurgeIncompleteOnly Set to false to purge all entries. Set to true to purge incomplete messages only.

ReinstateDeletedEntries()

void ReinstateDeletedEntries ( ) [private]

RemoveDeletedEntries()

void RemoveDeletedEntries ( ) [private]

Revert()

void Revert ( )

SetExtraStreamIdL(const TStreamId &)

IMPORT_C void SetExtraStreamIdL ( const TStreamId & aExtraStreamId ) [protected]

Sets the extra stream ID - changes it first in the internal entry array, and then externalizes it.

You must call Close() when the function returns.

capability
None

Parameters

const TStreamId & aExtraStreamId Extra stream ID

Member Enumerations Documentation

Enum anonymous

Enumerators

KNumStoreCommitsBeforeCompaction = 16

Member Data Documentation

TInt iCommitCount

TInt iCommitCount [private]

CArrayFixSeg< TSAREntry > iEntryArray

CArrayFixSeg < TSAREntry > iEntryArray [private]

TStreamId iExtraStreamId

TStreamId iExtraStreamId [private]

CFileStore * iFileStore

CFileStore * iFileStore [private]

RFs & iFs

RFs & iFs [protected]

TPtrC iFullName

TPtrC iFullName [private]

TBool iInTransaction

TBool iInTransaction [private]

TInt iMaxmumNumberOfMessagesInSegmentationStore

TInt iMaxmumNumberOfMessagesInSegmentationStore [protected]

Maximum number of SMS messages that can be stored in segmentation store.

TUid iThirdUid

TUid iThirdUid [private]