CImCaf Class Reference

class CImCaf : public CBase
Content Access Framework (CAF) Wrapper class. Provides encapsulation of the CAF functionality required by email MTMs. The in source documentation refers to a CAF session. The following pseudocode clarifies the concept of a CAF session.
BEGIN
	WHILE processing email MIME sections
		Receive MIME header Content-Type
		Pass to CAF with RegisterL(Content-Type)
		IF Registered()
			Add MIME header metadata to CImCaf class using AddToMetaDataL(metadata)
		ENDIF
		Detect start of MIME data section
		If CAF Registered()
			//BEGIN CAF session
			PrepareProcessingL()
			Create file handle for attachment write
			GetSuggestedAttachmentFileName(filename)
			StartProcessing(filename,filepath,file handle)
			WriteData() // Undecoded 1-N buffers in state machine
			Detect end of MIME data section
			WriteDataComplete()
			EndProcessingL()
			//END CAF Session
		ELSE
			Default behaviour
		ENDIF
	ENDWHILE
END

Inherits from

Constructor & Destructor Documentation

CImCaf(RFs &)

IMPORT_CCImCaf(RFs &aFs)

Construct with callers file session handle. c'tor

Parameters

RFs & aFs

~CImCaf()

IMPORT_C~CImCaf()[virtual]

d'tor

Member Functions Documentation

AddToMetaDataL(const TDesC8 &)

IMPORT_C voidAddToMetaDataL(const TDesC8 &aMimeLine)
Add Mime header metadata to CAF class in preparation for PrepareProcessingL() Parses a complete unfolded mime header line to extract fields and values Format expected: Fieldxxx: Valuexxx;ParamField=ParamValue If line does not contain "X-" or "Content-" then the method returns without adding data to the class.
panic
imut 36

Parameters

const TDesC8 & aMimeLine- Mime header data line minus CRLF

AddToMetaDataL(const TDesC8 &, const TDesC8 &)

IMPORT_C voidAddToMetaDataL(const TDesC8 &aField,
const TDesC8 &aData
)
Add Mime header metadata to CAF class in preparation for PrepareProcessingL() Metadata comprises a field and data pair. For example: aField - "X-Oma-Drm-Separate-Delivery" aData - "12" If field does not contain "X-" or "Content-" then the method returns without adding them to the class.
panic
imut 36

Parameters

const TDesC8 & aField- Mime header field
const TDesC8 & aData- Mime field's corresponding data

Deregister()

IMPORT_C voidDeregister()
Free resources allocated during CAF session
Pre-condition
RegisterL() must be called prior to this call.
panic
imut 36

EndProcessingL()

IMPORT_C voidEndProcessingL()
Terminate CAF session. Check the attachments under the attachment entry and see if there are any rights receipts. Set the mime type to a unique CAF one if there are.
panic
imut 36
Pre-condition
iServerEntry set to the attachment entry which owns the attachment

GetSuggestedAttachmentFileName(TDes &)

IMPORT_C TIntGetSuggestedAttachmentFileName(TDes &aFileName)const
Prior to StartProcessing() the CAF agent could provide an initial filename for the CAF session.
Pre-condition
PrepareProcessingL() must be called prior to this call.
panic
imut 36

Parameters

TDes & aFileNameDescriptor for writing CAF agent suggested filename.

NewFileL()

voidNewFileL()[private]

PrepareProcessingL()

IMPORT_C voidPrepareProcessingL()
Prepare the CImCAF class for a CAF session.
Pre-condition
RegisterL() must be called prior to this call and success checked with a Registered() call.
panic
imut 36

Processing()

IMPORT_C TBoolProcessing()const

Retrieve processing status for the CAF session.

RegisterL(const TDesC8 &)

IMPORT_C voidRegisterL(const TDesC8 &aMimeLine)
Attempt to register a mime content-type with a CAF agent. Success can be checked by a subsequent call to Registered().
panic
imut 36

Parameters

const TDesC8 & aMimeLineMIME Content-Type for possible interest by a CAF agent. For example - application/vnd.oma.drm.rights+xml

Registered()

IMPORT_C TBoolRegistered()const

Check whether RegisterL() succeeded.

StartProcessing(const TDesC &, const TDesC &, CMsvServerEntry &, RFile &)

IMPORT_C voidStartProcessing(const TDesC &aDefaultAttachmentFileName,
const TDesC &aAttachmentFilePath,
CMsvServerEntry &aServerEntry,
RFile &aStartFile
)
Set the CAF class variables required to Start the CAF write session.
Pre-condition
PrepareProcessingL() must be called prior to this call
aServerEntry aServerEntry is set to the attachment entry id and remains set there for the duration of the CAF session
panic
imut 36

Parameters

const TDesC & aDefaultAttachmentFileNameLocalised default attachment name.
const TDesC & aAttachmentFilePathIf CAF agent requires extra files, this is the folder/attachment entry path.
CMsvServerEntry & aServerEntryPointer to the message store attachment entry for the CAF session.
RFile & aStartFileAn open File handle for attachment write. Caller can close following this call.

WriteData(const TDesC8 &)

IMPORT_C TIntWriteData(const TDesC8 &aData)
Write a buffer of data to the CAF Agent.
Pre-condition
StartProcessingL() must be called prior to this call
Post-condition
Generates 0-N receipt files under the current message attachment entry.
panic
imut 36

Parameters

const TDesC8 & aDataData to write to the CAF agent.

WriteDataCompleteL()

voidWriteDataCompleteL()[private]

Member Data Documentation

RFile iAttachmentFile

RFile iAttachmentFile[private]

If open, handle is used for the next attachment file required by CAF. Initialised by StartProcessing()

TBuf< KMaxPath > iAttachmentFilePath

TBuf< KMaxPath >iAttachmentFilePath[private]

Stores the filepath for the current CAF session. Initialised by StartProcessing()

HBufC8 * iContentType

HBufC8 *iContentType[private]

Store for the MIME Content-type

TPtrC iDefaultAttachmentFileName

TPtrC iDefaultAttachmentFileName[private]

The localised default filename . Initialised by StartProcessing()

RFs & iFsSession

RFs &iFsSession[private]

Reference to instantiators file server session

CImportFile * iImportFile

CImportFile *iImportFile[private]

A CAF class instance. Initialised prior to data write

CMetaDataArray * iMetaData

CMetaDataArray *iMetaData[private]

A CAF class instance. Stores MIME header attribute/value pairs. Appended by AddToMetaData()

CMsvServerEntry * iServerEntry

CMsvServerEntry *iServerEntry[private]

Points to the Attachment Entry in use for the current CAF session.Initialised by StartProcessing()

CSupplier * iSupplier

CSupplier *iSupplier[private]

A CAF class instance. Used to register Content-type with CAF