ContentAccess::CCafMimeHeader Class Reference

class ContentAccess::CCafMimeHeader : public CBase

Packages the MIME header information for easy use by a Content Access Agent.

The "Content-Type" MIME header must be correct; other fields are optional from CAF's perspective, but may be mandatory for some agents.

Consider the following MIME header

        Content-type: application/vnd.oma.drm.content;
 Content-Length: 1234
 X-Oma-Drm-Separate-Delivery: 12
       

The CCafMimeHeader is constructed as follows:

        // initialise the header with the content type
 _LIT8(KMyMime,"application/vnd.oma.drm.content");
 CCafMimeHeader *header = CCafMimeHeader::NewL(KMyMime());
 
 // Set the content length
 _LIT8(KMyLength,"1234");
 header->SetStandardMimeDataL(EContentLength, KMyLength());
 
 // Set the non-standard header X-Oma-Drm-Separate-Delivery
 _LIT8(KMyField,"X-Oma-Drm-Separate-Delivery");
 _LIT8(KMyData,"12");
 header->AddNonStandardMimeL(KMyField(), KMyData());
       

To retreive the values from the CCafMimeHeader

        TPtrC8 contentType = header->StandardMimeData(EContentType);     // application/vnd.oma.drm.content
 TPtrC8 contentLength = header->StandardMimeData(EContentLength); // 1234

 TInt numNonStandard = header->NonStandardMimeCount();            // 1
 TPtrC8 field = header->NonStandardMimeField(0);                  // X-Oma-Drm-Separate-Delivery
 TPtrC8 data = header->NonStandardMimeData(0);                    // 12
       

Inherits from

  • ContentAccess::CCafMimeHeader

Constructor & Destructor Documentation

CCafMimeHeader()

CCafMimeHeader ( ) [private]

~CCafMimeHeader()

IMPORT_C ~CCafMimeHeader ( ) [virtual]

Destructor

Member Functions Documentation

AddNonStandardMimeL(const TDesC8 &, const TDesC8 &)

IMPORT_C void AddNonStandardMimeL ( const TDesC8 & aFieldName,
const TDesC8 & aData
)

Adds a new non-standard MIME header field.

e.g., OMA requires a MIME header "X-Oma-Drm-Separate-Delivery".

Parameters

const TDesC8 & aFieldName The ....
const TDesC8 & aData The data corresponding to the MIME header.

ConstructL(const TDesC8 &)

void ConstructL ( const TDesC8 & aContent_Type ) [private]

Parameters

const TDesC8 & aContent_Type

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) const

Externalizes the CCafMimeHeader object.

Allows the MIME header information to be passed between the client proxy and the CA agent server.

Parameters

RWriteStream & aStream The stream to write the header information to.

InternalizeL(RReadStream &)

IMPORT_C void InternalizeL ( RReadStream & aStream )

Internalize the CCafMimeHeader object.

Allows the MIME header information to be passed between the client proxy and the CA agent server.

Parameters

RReadStream & aStream The stream to read the header information from.

NewL(const TDesC8 &)

IMPORT_C CCafMimeHeader * NewL ( const TDesC8 & aContent_Type ) [static]

This creates the CCafMimeHeader object and calls SetFieldDataL(EContentType, aContent_Type);

A CCafMimeHeader must have a valid EContentType field, so the only constructor available requires this as a parameter.

Parameters

const TDesC8 & aContent_Type The "Content-Type :" field from the MIME header.

NonStandardMimeCount()

IMPORT_C TInt NonStandardMimeCount ( ) const

The number of non-standard MIME header fields.

e.g., OMA requires a MIME header "X-Oma-Drm-Separate-Delivery".

NonStandardMimeData(TInt)

IMPORT_C TPtrC8 NonStandardMimeData ( TInt aIndex ) const

Retrieves the data for a non-standard MIME header.

Parameters

TInt aIndex The index of the non-standard MIME header.

NonStandardMimeField(TInt)

IMPORT_C TPtrC8 NonStandardMimeField ( TInt aIndex ) const

Retrieves the field name for a non-standard MIME header.

Parameters

TInt aIndex The index of the non-standard MIME header.

SetStandardMimeDataL(const TMimeFields &, const TDesC8 &)

IMPORT_C void SetStandardMimeDataL ( const TMimeFields & aIndex,
const TDesC8 & aData
)

Sets the MIME data associated with a standard MIME field.

Parameters

const TMimeFields & aIndex The TMimeFields MIME header field.
const TDesC8 & aData The data corresponding to the MIME header.

StandardMimeData(const TMimeFields &)

IMPORT_C TPtrC8 StandardMimeData ( const TMimeFields & aIndex ) const

Gets the data associated with the standard MIME field.

Parameters

const TMimeFields & aIndex The TMimeFields MIME header to retrieve corresponding to the MIME data.

Member Data Documentation

RPointerArray< CMimeFieldAndData > iNonStandardMimeHeaders

RPointerArray < CMimeFieldAndData > iNonStandardMimeHeaders [private]

Non-standard header fields, some agents (e.g., OMA) need access to other MIME headers.

HBufC8 * iStandardMimeHeader

HBufC8 * iStandardMimeHeader [private]