Contents |
This API specifies the agent-specific attributes and commands for the OMA DRM CAF Agent. It is an extension to Symbian CAF API
API category | public |
API type | c++ |
Existed since | Legacy S60 3.0 |
Location | /sf/mw/drm/drm_pub/oma_drm_caf_agent_api
|
Buildfiles | /sf/mw/drm/drm_pub/oma_drm_caf_agent_api/group/bld.inf
|
OMA DRM CAF Agent API is a collection of enumerations and constants that can be used with CAF. It does not contain any classes or function declarations itself.
OMA DRM CAF API is available from S60 3.0 and onwards.
OMA DRM CAF Agent API covers agent-specific commands and attributes. These are handled by invoking the following CAF methods:
CManager
GetAttribute
GetAttributeSet
GetStringAttribute
GetStringAttributeSet
AgentSpecificCommand
CContent
GetAttribute
GetAttributeSet
GetStringAttribute
GetStringAttributeSet
AgentSpecificCommand
CData
GetAttribute
GetAttributeSet
GetStringAttribute
GetStringAttributeSet
AgentSpecificCommand
All the functions need to be called on an allocated object of the respective class.
Classes | Files |
---|---|
No classes | /epoc32/include/mw/Oma2Agent.h
|
This API does not contain any classes. All the classes required to use OMA DRM CAF Agent are parts of CAF API.
The following sections illustrate the most common use cases of OMA DRM CAF Agent API
// allocate a content object, specify that we only want to peek at it CContent* content = CContent::NewL(fileName, EPeek, EContentShareReadOnly); TInt value = 0; if (content->GetAttribute(EFileType, value) == KErrNone) { if (value == ENoDcf) { // the file is not an OMA DRM file } else if (value == EOma1Dcf) { // the file is an OMA DRM 1.0 file } else if (value == EOma2Dcf) { // the file is an OMA DRM 2.0 file } } else { // the file type could not be determined }
// allocate a data object, specify that we only want to peek at it, and // that we want the default part of the file CData* data = CData::NewL(TVirtualPathPtr(fileName, KDefaultContentObject), EPeek, EContentShareReadOnly); TBuf<256> part; if (data->GetStringAttribute(EInstantPreviewUri, part) == KErrNone && part.Length() > 0) { delete data; // open the part, now with the actual intent data = CData::NewL(TVirtualPathPtr(fileName, part), EView, EContentShareReadOnly); // do something with the data … } else { // no preview part available }
// allocate a content object, specify that we only want to peek at it, // but we need to be able to write CContent* content = CContent::NewL(fileName, EPeek, EContentShareReadWrite); if (content->AgentSpecificCommand(EEmbedDomainRo, KNullDesC, KNullDesC) == KErrNone) { // embedding succeeded }
// Import is handling via the CSupplier class CSupplier* supplier = CSupplier::NewLC(); CMetaDataArray* metaData = CMetaDataArray::NewLC(); // Set the target for the encrypted file supplier->SetOutputDirectoryL(KEncryptedDir); // The agent is selected based on the MIME type of the data to be imported CImportFile* file = supplier->ImportFileL(KOma1DrmMessageContentType, *metaData, KTempDcfName); file->WriteData(KDMSimple); file->WriteDataComplete(); CSupplierOutputFile& output = file->OutputFileL(0);
CSupplier* supplier = CSupplier::NewLC(); CMetaDataArray* metaData = CMetaDataArray::NewLC(); // Tell the agent which MIME type to use for the encrypted data metaData->AddL(KOmaImportMimeTypeField, _L8("image/gif")); supplier->SetOutputDirectoryL(KEncryptedDir); // The KOmaImportContentType is a OMA DRM agent specific MIME type which // indicates that plain content is to be encrypted CImportFile* file = supplier->ImportFileL(KOmaImportContentType, *metaData, KTempDcfName); file->WriteData(KDMSimple); file->WriteDataComplete(); CSupplierOutputFile& output = file->OutputFileL(0);
Error handling is defined in relevant CAF operations. In addition to that,
the KErrOverflow
error indicates that the given output buffer
is not large enough to hold the result of the requested operation.
The methods returning string attribute values and the agent specific commands
must be called with enough memory allocated in the output parameters. Otherwise,
the function calls fail with the KErrOverflow
error code.
CAF API can be extended using agent-specific commands and attributes, and OMA DRM CAF Agent API is such an extension. It is expected that any additional functionality of OMA DRM CAF Agent will be provided by adding new attribute and command enumeration values.
CAF | Content Access Framework |
DRM Agent | A collection of components that allow access to DRM-protected
data. |
OMA DRM CAF Agent | A DRM Agent, which implements the OMA DRM standard, a
part of S60. |
RFC2630: Cryptographic Message Syntax |