include/alp/alpdrm.h

Go to the documentation of this file.
00001 /********************************************************************
00002  *
00003  * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved.
00004  * Copyright 2006, 2007, ACCESS Systems Americas, Inc. All rights reserved.
00005  *
00006  * Version: MPL 1.1/LGPL 2.1
00007  *
00008  * The contents of this file are subject to the Mozilla Public License Version
00009  * 1.1 (the "License"); you may not use this file except in compliance with
00010  * the License. You may obtain a copy of the License at
00011  * http://www.mozilla.org/MPL/
00012  *
00013  * Software distributed under the License is distributed on an "AS IS" basis,
00014  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00015  * for the specific language governing rights and limitations under the
00016  * License.
00017  *
00018  * The Original Code is hikerproject.org code.
00019  *
00020  * The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00021  *               Portions created by the Initial Developer are
00022  *      Copyright 2006-2007 the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
00028  * case the provisions of the LGPL are applicable instead of those above.
00029  * If you wish to allow use of your version of this file only under the terms
00030  * of the LGPL, and not to allow others to use your version of this file under
00031  * the terms of the MPL, indicate your decision by deleting the provisions
00032  * above and replace them with the notice and other provisions required by
00033  * the LGPL. If you do not delete the provisions above, a recipient may use
00034  * your version of this file under the terms of either the MPL or the LGPL. 
00035  * You may obtain a copy of the LGPL at http://www.gnu.org/licenses/lgpl.txt.
00036  *
00037  ********************************************************************/
00045 #ifndef ALP_DRM_H_
00046 #define ALP_DRM_H_
00047 
00048 #include <stdio.h>
00049 #include <time.h>
00050 #include <glib.h>
00051 #include <hiker/config.h>
00052 #include <hiker/sysclass.h>
00053 #include <hiker/types.h>
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058 
00070 typedef enum{
00071         ALP_DRM_DELIVERY_FL, 
00072         ALP_DRM_DELIVERY_CD, 
00073         ALP_DRM_DELIVERY_SD, 
00074 }AlpDrmDeliveryMethod;
00076 
00081 #define ALP_DRM_STATUS_OK                       ALP_STATUS_OK  
00082 #define ALP_DRM_STATUS_INVALID_PARAM            (ALP_CLASS_DRM | 0x00010000) 
00083 #define ALP_DRM_STATUS_TIME_OUT                 (ALP_CLASS_DRM | 0x00020000) 
00084 #define ALP_DRM_STATUS_MEMORY_ERROR             (ALP_CLASS_DRM | 0x00030000) 
00085 #define ALP_DRM_STATUS_TYPE_MISMATCH            (ALP_CLASS_DRM | 0x00040000) 
00086 #define ALP_DRM_STATUS_FILE_ACCESS_DENIED       (ALP_CLASS_DRM | 0x00050000) 
00087 #define ALP_DRM_STATUS_FILE_NOT_FOUND           (ALP_CLASS_DRM | 0x00060000) 
00088 #define ALP_DRM_STATUS_NO_ENOUGH_SPACE          (ALP_CLASS_DRM | 0x00070000) 
00089 #define ALP_DRM_STATUS_RIGHTS_INVALID           (ALP_CLASS_DRM | 0x00080000) 
00090 #define ALP_DRM_STATUS_NO_RIGHTS_OBJECT         (ALP_CLASS_DRM | 0x00090000) 
00091 #define ALP_DRM_STATUS_RIGHTS_NOT_START         (ALP_CLASS_DRM | 0x000a0000) 
00092 #define ALP_DRM_STATUS_CANCELED_BY_USER         (ALP_CLASS_DRM | 0x000b0000) 
00093 #define ALP_DRM_STATUS_VOLUMESVCS_NOT_FOUND             (ALP_CLASS_DRM | 0x000c0000) 
00094 #define ALP_DRM_STATUS_VOLUMESVCS_DEVICE_BUSY           (ALP_CLASS_DRM | 0x000d0000) 
00095 #define ALP_DRM_STATUS_VOLUMESVCS_PROVIDE_ERR           (ALP_CLASS_DRM | 0x000e0000) 
00096 #define ALP_DRM_STATUS_ERR_GENERIC              (ALP_CLASS_DRM | 0x000f0000) 
00097 
00098 
00099 #define ALP_DM_HEAD_NOT_READY   0
00100 #define ALP_DM_HEAD_READY       1
00101 #define ALP_DM_HEAD_INVALID     -1
00102 #define ALP_DM_HEAD_ERROR       -2
00103 
00104  
00109 typedef enum{
00110         AlpDrmPermissionPlay,
00111         AlpDrmPermissionDisplay,
00112         AlpDrmPermissionExecute,
00113         AlpDrmPermissionPrint,
00114         AlpDrmPermissionNum,
00115 } AlpDrmPermissionType;
00116 
00118 
00119 
00121 enum {
00122         AlpDrmPDOK = 0,
00123         AlpDrmPDFail,
00124         AlpDrmPDHeadNotReady,
00125         AlpDrmPDHeadReady
00126 };
00128 
00133 
00134 typedef struct _AlpDrmMetaInfo AlpDrmMetaInfo; 
00135 
00137 
00138 struct _AlpDrmMetaInfo{
00140         char* fContentID;
00142         char* fContentVersion;
00144         char* fContentType;
00146         char* fTitle;
00148         char* fDescription;
00150         char* fContentVender;
00152         char* fIconURI;
00154         int fDeliveryMethod;
00156         char* fRightsIssuer;
00157 };
00158 
00159 
00160 
00166 typedef enum{
00168         ALP_DRM_META_INFO_CONTENT_ID    = (1 << 0), 
00170         ALP_DRM_META_INFO_CONTENT_VERSION       = (1 << 1),
00172         ALP_DRM_META_INFO_CONTENT_TYPE  = (1 << 2), 
00174         ALP_DRM_META_INFO_TITLE = (1 << 3), 
00176         ALP_DRM_META_INFO_DESCRIPTION   = (1 << 4), 
00178         ALP_DRM_META_INFO_CONTENT_VENDER        = (1 << 5), 
00180         ALP_DRM_META_INFO_ICON_URI      = (1 << 6),     
00182         ALP_DRM_META_INFO_DELIVERY_METHOD = (1 << 7),
00184         ALP_DRM_META_INFO_RIGHTS_ISSURER = (1 << 8),  
00186         ALP_DRM_META_INFO_MASK = ~((~0) << 9) 
00187 
00188 } ALP_DRM_META_INFO_ENUM;
00189 
00191 
00192 typedef struct _AlpDrmBuffer AlpDrmBuffer;
00193 
00200 gboolean alp_drm_is_drm_file(const char * filename);
00201 
00208 alp_status_t alp_drm_add_license(const char* mimetype, const char* filename);
00209 
00217 alp_status_t alp_drm_process_license_xml(const char* mimetype, const char* buffer, int size);
00218 
00226 FILE* alp_drm_fopen_with_permission(const char* filename, const char* mode, AlpDrmPermissionType permission_type);
00227 
00233 int alp_drm_fclose(FILE* fp);
00234 
00243 size_t alp_drm_fread(void *buf, size_t size, size_t count, FILE* fp);
00244 
00252 int alp_drm_fseek(FILE *fp, long offset, int whence);
00253 
00259 int alp_drm_ftell(FILE *fp);
00260 
00266 int alp_drm_ferror(FILE *fp);
00267 
00273 int alp_drm_feof(FILE *fp);
00274 
00275 
00289 alp_status_t alp_drm_update_constraints(FILE *fp, const char* content_id, int count);
00290 
00298 alp_status_t alp_drm_get_meta_data(const char* filename, int flags, AlpDrmMetaInfo *info);
00299 
00304 void alp_drm_free_meta_data(AlpDrmMetaInfo *info);
00305 
00319 alp_status_t alp_drm_check_rights_info(const char* filename, AlpDrmPermissionType permission_type, char** content_id, char** rights_issuer);
00320 
00332 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);
00333 
00345 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);
00346 
00351 const char* alp_drm_get_drm_path();
00352 
00353 
00368 alp_status_t alp_drm_add_content(const char *mimetype, const char *filename, const char* udi, gboolean keep, char **out_filename);
00369 
00370 
00371 
00382 alp_status_t alp_drm_get_dm_info(const char * filename ,char ** mimetype);
00383 
00384 
00391 AlpDrmBuffer * alp_drm_buffer_initialize();
00392 
00393 
00409 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);
00410 
00411 
00417 char * alp_drm_buffer_get_mime(AlpDrmBuffer * drmbuffer);
00418 
00419 
00426 void alp_drm_buffer_finalize(AlpDrmBuffer * drmbuffer);
00427 
00428 
00432 #ifdef __cplusplus
00433 }
00434 #endif
00435 
00436 #endif /*ALP_DRM_H_*/
00437 
00438 

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

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