DRM library
[Multimedia]


Detailed Description

APIs for DRM is for device only , not delivery with simulator in SDK.


Data Structures

struct  _AlpDrmMetaInfo

Errors

#define ALP_DM_HEAD_ERROR   -2
#define ALP_DM_HEAD_INVALID   -1
#define ALP_DM_HEAD_NOT_READY   0
#define ALP_DM_HEAD_READY   1
#define ALP_DRM_STATUS_CANCELED_BY_USER   (ALP_CLASS_DRM | 0x000b0000)
 Dialog closed by user.
#define ALP_DRM_STATUS_ERR_GENERIC   (ALP_CLASS_DRM | 0x000f0000)
 Generic error.
#define ALP_DRM_STATUS_FILE_ACCESS_DENIED   (ALP_CLASS_DRM | 0x00050000)
 File right error.
#define ALP_DRM_STATUS_FILE_NOT_FOUND   (ALP_CLASS_DRM | 0x00060000)
 File not found.
#define ALP_DRM_STATUS_INVALID_PARAM   (ALP_CLASS_DRM | 0x00010000)
 Parameter Invalid.
#define ALP_DRM_STATUS_MEMORY_ERROR   (ALP_CLASS_DRM | 0x00030000)
 Memory leak.
#define ALP_DRM_STATUS_NO_ENOUGH_SPACE   (ALP_CLASS_DRM | 0x00070000)
 No enough spaces.
#define ALP_DRM_STATUS_NO_RIGHTS_OBJECT   (ALP_CLASS_DRM | 0x00090000)
 Right ro not found.
#define ALP_DRM_STATUS_OK   ALP_STATUS_OK
 no Error
#define ALP_DRM_STATUS_RIGHTS_INVALID   (ALP_CLASS_DRM | 0x00080000)
 Right invalid.
#define ALP_DRM_STATUS_RIGHTS_NOT_START   (ALP_CLASS_DRM | 0x000a0000)
 Right invalid.
#define ALP_DRM_STATUS_TIME_OUT   (ALP_CLASS_DRM | 0x00020000)
 Time waiting out.
#define ALP_DRM_STATUS_TYPE_MISMATCH   (ALP_CLASS_DRM | 0x00040000)
 Type mismatch.
#define ALP_DRM_STATUS_VOLUMESVCS_DEVICE_BUSY   (ALP_CLASS_DRM | 0x000d0000)
 Card not writable.
#define ALP_DRM_STATUS_VOLUMESVCS_NOT_FOUND   (ALP_CLASS_DRM | 0x000c0000)
 Not found the extend card.
#define ALP_DRM_STATUS_VOLUMESVCS_PROVIDE_ERR   (ALP_CLASS_DRM | 0x000e0000)
 Volume system fail.

DRM Meta Info Structs

typedef _AlpDrmMetaInfo AlpDrmMetaInfo
 Meta data info struct.

DRM Operation Permission types

enum  { AlpDrmPDOK = 0, AlpDrmPDFail, AlpDrmPDHeadNotReady, AlpDrmPDHeadReady }

DRM Meta Info marks

enum  ALP_DRM_META_INFO_ENUM {
  ALP_DRM_META_INFO_CONTENT_ID = (1 << 0), ALP_DRM_META_INFO_CONTENT_VERSION = (1 << 1), ALP_DRM_META_INFO_CONTENT_TYPE = (1 << 2), ALP_DRM_META_INFO_TITLE = (1 << 3),
  ALP_DRM_META_INFO_DESCRIPTION = (1 << 4), ALP_DRM_META_INFO_CONTENT_VENDER = (1 << 5), ALP_DRM_META_INFO_ICON_URI = (1 << 6), ALP_DRM_META_INFO_DELIVERY_METHOD = (1 << 7),
  ALP_DRM_META_INFO_RIGHTS_ISSURER = (1 << 8), ALP_DRM_META_INFO_MASK = ~((~0) << 9)
}

DRM types of drms

enum  AlpDrmDeliveryMethod { ALP_DRM_DELIVERY_FL, ALP_DRM_DELIVERY_CD, ALP_DRM_DELIVERY_SD }

DRM Operation Permission types

enum  AlpDrmPermissionType {
  AlpDrmPermissionPlay, AlpDrmPermissionDisplay, AlpDrmPermissionExecute, AlpDrmPermissionPrint,
  AlpDrmPermissionNum
}

Typedefs

typedef _AlpDrmBuffer AlpDrmBuffer

Functions

alp_status_t alp_drm_add_content (const char *mimetype, const char *filename, const char *udi, gboolean keep, char **out_filename)
alp_status_t alp_drm_add_license (const char *mimetype, const char *filename)
void alp_drm_buffer_finalize (AlpDrmBuffer *drmbuffer)
int alp_drm_buffer_get_buffer (AlpDrmBuffer *drmbuffer, char *in_buffer, size_t in_buffer_len, char *out_buffer, size_t out_buffer_len, unsigned int is_end)
char * alp_drm_buffer_get_mime (AlpDrmBuffer *drmbuffer)
AlpDrmBufferalp_drm_buffer_initialize ()
alp_status_t alp_drm_check_rights_info (const char *filename, AlpDrmPermissionType permission_type, char **content_id, char **rights_issuer)
int alp_drm_fclose (FILE *fp)
int alp_drm_feof (FILE *fp)
int alp_drm_ferror (FILE *fp)
FILE * alp_drm_fopen_with_permission (const char *filename, const char *mode, AlpDrmPermissionType permission_type)
size_t alp_drm_fread (void *buf, size_t size, size_t count, FILE *fp)
void alp_drm_free_meta_data (AlpDrmMetaInfo *info)
int alp_drm_fseek (FILE *fp, long offset, int whence)
int alp_drm_ftell (FILE *fp)
alp_status_t alp_drm_get_constraints (const char *content_id, AlpDrmPermissionType permission_type, int *count, time_t *start_data_time, time_t *end_data_time, time_t *interval_start, time_t *interval_duration)
alp_status_t alp_drm_get_dm_info (const char *filename, char **mimetype)
const char * alp_drm_get_drm_path ()
alp_status_t alp_drm_get_file_constraints (const char *filename, AlpDrmPermissionType permission_type, int *count, time_t *start_data_time, time_t *end_data_time, time_t *interval_start, time_t *interval_duration)
alp_status_t alp_drm_get_meta_data (const char *filename, int flags, AlpDrmMetaInfo *info)
gboolean alp_drm_is_drm_file (const char *filename)
alp_status_t alp_drm_process_license_xml (const char *mimetype, const char *buffer, int size)
alp_status_t alp_drm_update_constraints (FILE *fp, const char *content_id, int count)


Define Documentation

#define ALP_DM_HEAD_ERROR   -2
 

#define ALP_DM_HEAD_INVALID   -1
 

#define ALP_DM_HEAD_NOT_READY   0
 

#define ALP_DM_HEAD_READY   1
 

#define ALP_DRM_STATUS_CANCELED_BY_USER   (ALP_CLASS_DRM | 0x000b0000)
 

Dialog closed by user.

#define ALP_DRM_STATUS_ERR_GENERIC   (ALP_CLASS_DRM | 0x000f0000)
 

Generic error.

#define ALP_DRM_STATUS_FILE_ACCESS_DENIED   (ALP_CLASS_DRM | 0x00050000)
 

File right error.

#define ALP_DRM_STATUS_FILE_NOT_FOUND   (ALP_CLASS_DRM | 0x00060000)
 

File not found.

#define ALP_DRM_STATUS_INVALID_PARAM   (ALP_CLASS_DRM | 0x00010000)
 

Parameter Invalid.

#define ALP_DRM_STATUS_MEMORY_ERROR   (ALP_CLASS_DRM | 0x00030000)
 

Memory leak.

#define ALP_DRM_STATUS_NO_ENOUGH_SPACE   (ALP_CLASS_DRM | 0x00070000)
 

No enough spaces.

#define ALP_DRM_STATUS_NO_RIGHTS_OBJECT   (ALP_CLASS_DRM | 0x00090000)
 

Right ro not found.

#define ALP_DRM_STATUS_OK   ALP_STATUS_OK
 

no Error

#define ALP_DRM_STATUS_RIGHTS_INVALID   (ALP_CLASS_DRM | 0x00080000)
 

Right invalid.

#define ALP_DRM_STATUS_RIGHTS_NOT_START   (ALP_CLASS_DRM | 0x000a0000)
 

Right invalid.

#define ALP_DRM_STATUS_TIME_OUT   (ALP_CLASS_DRM | 0x00020000)
 

Time waiting out.

#define ALP_DRM_STATUS_TYPE_MISMATCH   (ALP_CLASS_DRM | 0x00040000)
 

Type mismatch.

#define ALP_DRM_STATUS_VOLUMESVCS_DEVICE_BUSY   (ALP_CLASS_DRM | 0x000d0000)
 

Card not writable.

#define ALP_DRM_STATUS_VOLUMESVCS_NOT_FOUND   (ALP_CLASS_DRM | 0x000c0000)
 

Not found the extend card.

#define ALP_DRM_STATUS_VOLUMESVCS_PROVIDE_ERR   (ALP_CLASS_DRM | 0x000e0000)
 

Volume system fail.


Typedef Documentation

typedef struct _AlpDrmBuffer AlpDrmBuffer
 

typedef struct _AlpDrmMetaInfo AlpDrmMetaInfo
 

Meta data info struct.


Enumeration Type Documentation

anonymous enum
 

Enumerator:
AlpDrmPDOK 
AlpDrmPDFail 
AlpDrmPDHeadNotReady 
AlpDrmPDHeadReady 

enum ALP_DRM_META_INFO_ENUM
 

Enumerator:
ALP_DRM_META_INFO_CONTENT_ID  Contend ID
ALP_DRM_META_INFO_CONTENT_VERSION  Contend Version
ALP_DRM_META_INFO_CONTENT_TYPE  Content Type , Origion MIME
ALP_DRM_META_INFO_TITLE  Title
ALP_DRM_META_INFO_DESCRIPTION  Description
ALP_DRM_META_INFO_CONTENT_VENDER  Content Vender
ALP_DRM_META_INFO_ICON_URI  Icon URI
ALP_DRM_META_INFO_DELIVERY_METHOD  Delivery Type
ALP_DRM_META_INFO_RIGHTS_ISSURER  Right Issuer
ALP_DRM_META_INFO_MASK  Mask

enum AlpDrmDeliveryMethod
 

Enumerator:
ALP_DRM_DELIVERY_FL  Forward Lock type.
ALP_DRM_DELIVERY_CD  Combined Delivery type.
ALP_DRM_DELIVERY_SD  Separate Delivery type.

enum AlpDrmPermissionType
 

Enumerator:
AlpDrmPermissionPlay  Play Permession.
AlpDrmPermissionDisplay  Display Permession.
AlpDrmPermissionExecute  Excute Permession.
AlpDrmPermissionPrint  Print Permession.
AlpDrmPermissionNum  Numbers of permission type.


Function Documentation

alp_status_t alp_drm_add_content const char *  mimetype,
const char *  filename,
const char *  udi,
gboolean  keep,
char **  out_filename
 

Adds a file to the device or card This function encrypts a DRM resource file (usually a DRM file) into a DCFfile

Parameters:
[in] mimetype The MIME type of the file
[in] filename The URI of the temp file
[in] udi Indicates the method for installing the *.dm file; NULL: stores the file on the device; otherwise, declares the UDI of the extendcard.
[in] keep Either keeps or deletes the temp file; -1 is used for a progressive download only (does not install the RO if it is a CD file)
[out] out_filename The URI of the file after saving
Returns:
ALP_DRM_STATUS_OK - success
ALP_DRM_STATUS_VOLUMESVCS_NOT_FOUND The card is not found
ALP_DRM_STATUS_VOLUMESVCS_DEVICE_BUSY the card is busy now
ALP_DRM_STATUS_VOLUMESVCS_PROVIDE_ERR the card is not available

alp_status_t alp_drm_add_license const char *  mimetype,
const char *  filename
 

Adds a license (RO) for a specific type of DRM file.

Parameters:
[in] mimetype The MIME of the drm file, which is usually application/vnd.oma.drm.right+(wbx)xml
[in] filename The filename of the right file (RO).
Returns:
ALP_DRM_STATUS_OK - success

void alp_drm_buffer_finalize AlpDrmBuffer drmbuffer  ) 
 

Finalizes the context for the DRM buffer stream.

Parameters:
[in] drmbuffer The context returned by alp_drm_buffer_initialize.

int alp_drm_buffer_get_buffer AlpDrmBuffer drmbuffer,
char *  in_buffer,
size_t  in_buffer_len,
char *  out_buffer,
size_t  out_buffer_len,
unsigned int  is_end
 

Retrieves the original data from the DRM content stream.

Parameters:
[in] drmbuffer The context returned by alp_drm_buffer_initialize.
[in] in_buffer The DRM content that must be parsed in order to retrieve the original data.
[in] in_buffer_len The size of in_buffer
in/out] out_buffer The buffer used to save the parsed data
[in] out_buffer_len The size of out_buffer
[in] is_end Indicates whether or not this is the last data for the content.
Returns:
ALP_DM_HEAD_NOT_READY -The data for the content still not full
ALP_DM_HEAD_INVALID The data for the content in a wrong format
ALP_DM_HEAD_ERROR Meet system error for the data
number>ALP_DM_HEAD_READY(1): the head is ready and the original data is parsed.

char* alp_drm_buffer_get_mime AlpDrmBuffer drmbuffer  ) 
 

Retrieves the original MIME type from the context for the DRM content stream.

Parameters:
[in] drmbuffer The context returned by alp_drm_buffer_initialize
Returns:
string The original MIME type of the DRM content stream.

AlpDrmBuffer* alp_drm_buffer_initialize  ) 
 

Initializes for the DRM buffer in the stream mode; this allows the application read the DRM content buffer by buffer.

Returns:
NULL - buffer initialize fail
alpDrmBuffer The context for next operation

alp_status_t alp_drm_check_rights_info const char *  filename,
AlpDrmPermissionType  permission_type,
char **  content_id,
char **  rights_issuer
 

Checks the rights information for a DRM file

Parameters:
[in] filename The file to be checked for the rights information
[in] permission_type The permission type to be checked; see AlpDrmPermissionType
[out] content_id The content_id for the file; can be NULL
[out] rights_issuer The URL of the holder of the rights for the file; can be NULL
Returns:
ALP_DRM_STATUS_OK - Success
ALP_DRM_STATUS_NO_RIGHTS_OBJECT - No rights object for the permission type required
ALP_DRM_STATUS_RIGHTS_INVALID - The rights object has expired or cannot be used at this time
ALP_DRM_STATUS_RIGHTS_NOT_START - The valid start date is in the future ALP_DRM_STATUS_INVALID_PARAM - There is a parameter error
ALP_DRM_STATUS_MEMORY_ERROR - There is a memory shortage problem

int alp_drm_fclose FILE *  fp  ) 
 

Closes a file opened by alp_drm_fopen_with_permission

Parameters:
[in] fp the file handle returned by alp_drm_fopen_with_permission
Returns:
0 - success

int alp_drm_feof FILE *  fp  ) 
 

Checks whether or not the current position has reached the end of a file

Parameters:
[in] fp the file handle returned by alp_drm_fopen_with_permission
Returns:
>0 - reach the end of the file

int alp_drm_ferror FILE *  fp  ) 
 

Checks the latest error information related to the specified file

Parameters:
[in] fp the file handle returned by alp_drm_fopen_with_permission
Returns:
0 - success

FILE* alp_drm_fopen_with_permission const char *  filename,
const char *  mode,
AlpDrmPermissionType  permission_type
 

Opens a DRM file with operation permission

Parameters:
[in] filename The file to be opened
[in] mode In which mode to open the file; only "r" or "rb" is allowed
[in] permission_type With which operation permission to open the file
Returns:
the file handle of the open file.

size_t alp_drm_fread void *  buf,
size_t  size,
size_t  count,
FILE *  fp
 

Reads data from an opened DRM file and saves it to the specified buffer

Parameters:
[out] buf The buffer that is used to hold the data read from the file
[in] size The size of the data to be read as a unit [in] count The number of units to be read
[in] fp The file handle returned by alp_drm_fopen_with_permission
Returns:
the whole size of the read data

void alp_drm_free_meta_data AlpDrmMetaInfo info  ) 
 

Frees the structure of the information data that is required by alp_drm_get_meta_data.

Parameters:
[in] info the struct to hold the infomation

int alp_drm_fseek FILE *  fp,
long  offset,
int  whence
 

Seeks the current position in a file

Parameters:
[in] fp The file handle returned by alp_drm_fopen_with_permission
[in] offset The characters to be moved
[in] whence The location to move the position from
Returns:
0 - success

int alp_drm_ftell FILE *  fp  ) 
 

Returns the position of a file handle.

Parameters:
[in] fp the file handle returned by alp_drm_fopen_with_permission
Returns:
Returns the position on a file handle

alp_status_t alp_drm_get_constraints const char *  content_id,
AlpDrmPermissionType  permission_type,
int *  count,
time_t *  start_data_time,
time_t *  end_data_time,
time_t *  interval_start,
time_t *  interval_duration
 

Retrieves the file constraints upon a DRM file, as specified by the content ID

Parameters:
[in] content_id The content ID returned from alp_drm_check_rights_info
[in] permission_type The permission type to be checked; see AlpDrmPermissionType
[out] count The left number of times to use this file
[out] start_data_time A valid time to begin using this file
[out] end_data_time A valid time to stop using this file
[out] interval_start The first time that this file is used
[out] interval_duration A valid period of time for using this file, which begins with interval_start
Returns:
ALP_DRM_STATUS_OK - success

alp_status_t alp_drm_get_dm_info const char *  filename,
char **  mimetype
 

Retrieves information from a DRM file. The function is used for progressive download only.

Parameters:
[in] filename The URI of the temp file.
[out] mimetype the file's MIME type.
Returns:
ALP_DM_HEAD_READY - success
ALP_DM_HEAD_NOT_READY head not ready ,still need more content
ALP_DM_HEAD_NOT_INVALIE No right or header in a wrong format

const char* alp_drm_get_drm_path  ) 
 

Retrieves the directory where the DRM files are stored; this is usually "/home/drm/" on the device.

Returns:
strings, the directory where the DRM files reside

alp_status_t alp_drm_get_file_constraints const char *  filename,
AlpDrmPermissionType  permission_type,
int *  count,
time_t *  start_data_time,
time_t *  end_data_time,
time_t *  interval_start,
time_t *  interval_duration
 

Retrieves the file constraints upon a DRM file

Parameters:
[in] filename The file to be checked for permission
[in] permission_type The field of the permission type to be retrieved; see AlpDrmPermissionType
[out] count The number of times left for using this file
[out] start_data_time Valid begin time
[out] end_data_time Valid end time
[out] interval_start The first time to use this file
[out] interval_duration The length of valid period begins from the interval_start
Returns:
ALP_DRM_STATUS_OK - success

alp_status_t alp_drm_get_meta_data const char *  filename,
int  flags,
AlpDrmMetaInfo info
 

Retrieves information about a DRM file

Parameters:
[in] filename The name of the file from which information is to be retrieved
[in] flags The field of the information to be retrieved; see ALP_DRM_META_INFO_ENUM
[in] info The structure in which to hold the information
Returns:
ALP_DRM_STATUS_OK - success

gboolean alp_drm_is_drm_file const char *  filename  ) 
 

Determines whether or not the file is a DRM file.

Parameters:
[in] filename The file to be determined.
Returns:
TRUE - The file is a DRM-protected file in DCF format
FALSE - Not a drm file

alp_status_t alp_drm_process_license_xml const char *  mimetype,
const char *  buffer,
int  size
 

Adds a license (RO) for a specific type of data buffer

Parameters:
[in] mimetype The MIME of the drm file which is usually application/vnd.oma.drm.right+(wbx)xml
[in] buffer The content of the file (RO).
[in] size The size of the buffer.
Returns:
ALP_DRM_STATUS_OK - success

alp_status_t alp_drm_update_constraints FILE *  fp,
const char *  content_id,
int  count
 

Updates the constraints upon a file This function should be called directly after the user has either begun or finished one of these valid actions: play/display/print/execute. For example, Audio/Video should call this API when the user clicks the "Play" button and sees video content on the screen. This API should be called as early as possible.

Parameters:
[in] fp The file handle returned by alp_drm_fopen_with_permission
[in] content_id The content ID for the file
[in] count The number of times that the user has played the file; usually 1 for this parameter
Returns:
ALP_DRM_STATUS_OK - success


Generated on Wed Jul 30 07:06:42 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.