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
Public Member Functions | |
---|---|
~CCafMimeHeader () | |
IMPORT_C void | AddNonStandardMimeL (const TDesC8 &, const TDesC8 &) |
IMPORT_C void | ExternalizeL ( RWriteStream &) |
IMPORT_C void | InternalizeL ( RReadStream &) |
IMPORT_C CCafMimeHeader * | NewL (const TDesC8 &) |
IMPORT_C TInt | NonStandardMimeCount () |
IMPORT_C TPtrC8 | NonStandardMimeData ( TInt ) |
IMPORT_C TPtrC8 | NonStandardMimeField ( TInt ) |
IMPORT_C void | SetStandardMimeDataL (const TMimeFields &, const TDesC8 &) |
IMPORT_C TPtrC8 | StandardMimeData (const TMimeFields &) |
Private Member Functions | |
---|---|
CCafMimeHeader () | |
void | ConstructL (const TDesC8 &) |
Private Attributes | |
---|---|
RPointerArray < CMimeFieldAndData > | iNonStandardMimeHeaders |
HBufC8 * | iStandardMimeHeader |
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".
void | ConstructL | ( | const TDesC8 & | aContent_Type | ) | [private] |
const TDesC8 & aContent_Type |
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.
RWriteStream & aStream | The stream to write the header information to. |
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.
RReadStream & aStream | The stream to read the header information from. |
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.
const TDesC8 & aContent_Type | The "Content-Type :" field from the MIME header. |
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".
IMPORT_C TPtrC8 | NonStandardMimeData | ( | TInt | aIndex | ) | const |
Retrieves the data for a non-standard MIME header.
TInt aIndex | The index of the non-standard MIME header. |
IMPORT_C TPtrC8 | NonStandardMimeField | ( | TInt | aIndex | ) | const |
Retrieves the field name for a non-standard MIME header.
TInt aIndex | The index of the non-standard MIME header. |
IMPORT_C void | SetStandardMimeDataL | ( | const TMimeFields & | aIndex, |
const TDesC8 & | aData | |||
) |
Sets the MIME data associated with a standard MIME field.
const TMimeFields & aIndex | The TMimeFields MIME header field. |
const TDesC8 & aData | The data corresponding to the MIME header. |
IMPORT_C TPtrC8 | StandardMimeData | ( | const TMimeFields & | aIndex | ) | const |
Gets the data associated with the standard MIME field.
const TMimeFields & aIndex | The TMimeFields MIME header to retrieve corresponding to the MIME data. |
RPointerArray < CMimeFieldAndData > | iNonStandardMimeHeaders | [private] |
Non-standard header fields, some agents (e.g., OMA) need access to other MIME headers.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.